From b96b822474dde96162c24748829b0b56d53b637b Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 20 Jan 2017 00:28:04 +0200 Subject: [PATCH] [test] Added option to test inline css parsing --- test/test-css/main.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/test-css/main.cpp b/test/test-css/main.cpp index b96c77b..b1095aa 100644 --- a/test/test-css/main.cpp +++ b/test/test-css/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Jolla Ltd. + * Copyright (C) 2015-2017 Jolla Ltd. * Contact: Slava Monich * * You may use this file under the terms of the BSD license as follows: @@ -231,7 +231,6 @@ process( fres.close(); if (buf.str() != out.str()) { std::cerr << "Test output mismatch with " << res << std::endl; - //std::cerr << out.str(); ret = RET_ERR_TEST; } } else { @@ -251,11 +250,14 @@ int main(int argc, char **argv) int ret; char* customDataDir = NULL; gboolean autoTest = FALSE; + char* inlineCSS = FALSE; #define DATA_DIR "data" GOptionEntry entries[] = { { "autotest", 'a', 0, G_OPTION_ARG_NONE, &autoTest, "Run auto-tests", NULL }, + { "inline", 'i', 0, G_OPTION_ARG_STRING, &inlineCSS, + "Parse inline CSS", NULL }, { "data", 'd', 0, G_OPTION_ARG_FILENAME, &customDataDir, "Data directory for autotest [" DATA_DIR "]", "DIR" }, { NULL } @@ -267,7 +269,7 @@ int main(int argc, char **argv) gboolean ok = g_option_context_parse(options, &argc, &argv, &error); if (ok) { - if (argc == 1 && !autoTest) { + if (argc == 1 && !autoTest && !inlineCSS) { ret = RET_CMD_LINE; char* help = g_option_context_get_help(options, FALSE, NULL); std::cout << help; @@ -276,6 +278,10 @@ int main(int argc, char **argv) ret = RET_OK; ZLQtFSManager::createInstance(); ZLFile::initCache(); + if (inlineCSS) { + StyleSheetSingleStyleParser parser; + parser.parseString(inlineCSS); + } if (argc > 1) { for (int i=1; i