diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ft_mstylesheet/ft_mstylesheet.pro | 4 | ||||
-rw-r--r-- | tests/ft_mstylesheetparser/ft_mstylesheetparser.cpp | 165 | ||||
-rw-r--r-- | tests/ft_mstylesheetparser/ft_mstylesheetparser.pro | 7 | ||||
-rw-r--r-- | tests/ut_mlogicalvalues/ut_mlogicalvalues.pro | 7 |
4 files changed, 88 insertions, 95 deletions
diff --git a/tests/ft_mstylesheet/ft_mstylesheet.pro b/tests/ft_mstylesheet/ft_mstylesheet.pro index 1207f2b6..78f8a940 100644 --- a/tests/ft_mstylesheet/ft_mstylesheet.pro +++ b/tests/ft_mstylesheet/ft_mstylesheet.pro @@ -11,8 +11,7 @@ STYLE_HEADERS += testobjectstyle.h testobject2style.h testobject3style.h SOURCES += \ ft_mstylesheet.cpp \ $$MSRCDIR/corelib/theme/mlogicalvalues.cpp \ - $$MSRCDIR/corelib/style/mstylesheetattribute.cpp \ - $$MSRCDIR/corelib/style/muniquestringcache.cpp + $$MSRCDIR/corelib/style/mstylesheetattribute.cpp HEADERS += \ ft_mstylesheet.h \ @@ -24,7 +23,6 @@ HEADERS += \ testwidget3.h \ $$MSRCDIR/corelib/theme/mlogicalvalues.h \ $$MSRCDIR/corelib/style/mstylesheetattribute.h \ - $$MSRCDIR/corelib/style/muniquestringcache.h \ $$STYLE_HEADERS support_files.files += \ diff --git a/tests/ft_mstylesheetparser/ft_mstylesheetparser.cpp b/tests/ft_mstylesheetparser/ft_mstylesheetparser.cpp index fff45d74..154f7125 100644 --- a/tests/ft_mstylesheetparser/ft_mstylesheetparser.cpp +++ b/tests/ft_mstylesheetparser/ft_mstylesheetparser.cpp @@ -28,7 +28,7 @@ // include this to get theme profiling support //#include "../../src/corelib/theme/mtheme_p.h" -const int NUMBER_OF_LOOPS = 10000; +const int NUMBER_OF_LOOPS = 100; Ft_MStyleSheetParser::Ft_MStyleSheetParser() : m_logicalValues(NULL), @@ -444,51 +444,50 @@ void Ft_MStyleSheetParser::test_constants() info = m_subject->fileInfoList()[1]; QCOMPARE(info->selectors.count(), 1); QCOMPARE(info->selectors[0]->attributes()->count(), 1); - info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex("attr-width"), NULL); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-width")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-width")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-width")))->getValue(), QByteArray("10px")); + info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"), NULL); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))->getValue(), QByteArray("10px")); info = m_subject->fileInfoList()[2]; QCOMPARE(info->selectors.count(), 1); QCOMPARE(info->selectors[0]->attributes()->count(), 13); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-int")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-int")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-int")))->getValue(), QByteArray("10")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))); - - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1")))->getValue(), QByteArray("\"name\"")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2")))->getValue(), QByteArray("\"this is a string with constant \"name\"\" 10 1.0")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool")))->getValue(), QByteArray("true")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1")))->getValue(), QByteArray("10px 15px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2")))->getValue(), QByteArray("17px 11px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1")))->getValue(), QByteArray("sans 12px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2")))->getValue(), QByteArray("arial 10px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-color")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-color")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-color")))->getValue(), QByteArray("#0abba0")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid")))->getValue(), QByteArray("")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-void")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-void")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-void")))->getValue(), QByteArray("")); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black")))->getValue(), QByteArray("#000000")); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green")))->getValue(), QByteArray("#00ff00")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))->getValue(), QByteArray("10")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))->getValue(), QByteArray("\"name\"")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))->getValue(), QByteArray("\"this is a string with constant \"name\"\" 10 1.0")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))->getValue(), QByteArray("true")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))->getValue(), QByteArray("10px 15px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))->getValue(), QByteArray("17px 11px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))->getValue(), QByteArray("sans 12px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))->getValue(), QByteArray("arial 10px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))->getValue(), QByteArray("#0abba0")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))->getValue(), QByteArray("")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))->getValue(), QByteArray("")); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))->getValue(), QByteArray("#000000")); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))->getValue(), QByteArray("#00ff00")); } void Ft_MStyleSheetParser::test_constants_binary() @@ -514,49 +513,49 @@ void Ft_MStyleSheetParser::test_constants_binary() info = m_subject->fileInfoList()[1]; QCOMPARE(info->selectors.count(), 1); QCOMPARE(info->selectors[0]->attributes()->count(), 1); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-width")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-width")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-width")))->getValue(), QByteArray("10px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-width"))->getValue(), QByteArray("10px")); info = m_subject->fileInfoList()[2]; QCOMPARE(info->selectors.count(), 1); QCOMPARE(info->selectors[0]->attributes()->count(), 13); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-int")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-int")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-int")))->getValue(), QByteArray("10")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1")))->getValue(), QByteArray("\"name\"")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2")))->getValue(), QByteArray("\"this is a string with constant \"name\"\" 10 1.0")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool")))->getValue(), QByteArray("true")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1")))->getValue(), QByteArray("10px 15px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2")))->getValue(), QByteArray("17px 11px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1")))->getValue(), QByteArray("sans 12px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2")))->getValue(), QByteArray("arial 10px")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-color")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-color")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-color")))->getValue(), QByteArray("#0abba0")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid")))->getValue(), QByteArray("")); - QVERIFY(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-void")), NULL)); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-void")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-void")))->getValue(), QByteArray("")); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black")))->getValue(), QByteArray("#000000")); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green")))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))); - QCOMPARE(info->selectors[0]->attributes()->value(MUniqueStringCache::stringToIndex(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green")))->getValue(), QByteArray("#00ff00")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-int"))->getValue(), QByteArray("10")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string1"))->getValue(), QByteArray("\"name\"")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-string2"))->getValue(), QByteArray("\"this is a string with constant \"name\"\" 10 1.0")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-bool"))->getValue(), QByteArray("true")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos1"))->getValue(), QByteArray("10px 15px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-pos2"))->getValue(), QByteArray("17px 11px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font1"))->getValue(), QByteArray("sans 12px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-font2"))->getValue(), QByteArray("arial 10px")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-color"))->getValue(), QByteArray("#0abba0")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-invalid"))->getValue(), QByteArray("")); + QVERIFY(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"), NULL)); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-void"))->getValue(), QByteArray("")); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-black"))->getValue(), QByteArray("#000000")); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))->getName(), QByteArray(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))); + QCOMPARE(info->selectors[0]->attributes()->value(MStyleSheetAttribute::attributeNameToPropertyName("attr-logical-green"))->getValue(), QByteArray("#00ff00")); } void Ft_MStyleSheetParser::test_binary_equality() diff --git a/tests/ft_mstylesheetparser/ft_mstylesheetparser.pro b/tests/ft_mstylesheetparser/ft_mstylesheetparser.pro index efcf1ff3..afe434f6 100644 --- a/tests/ft_mstylesheetparser/ft_mstylesheetparser.pro +++ b/tests/ft_mstylesheetparser/ft_mstylesheetparser.pro @@ -8,14 +8,13 @@ INCLUDEPATH += $$MSRCDIR/corelib/core/ SOURCES += \ ft_mstylesheetparser.cpp \ $$MSRCDIR/corelib/theme/mlogicalvalues.cpp \ - $$MSRCDIR/corelib/style/muniquestringcache.cpp \ - $$MSRCDIR/corelib/style/mstylesheetattribute.cpp \ + $$MSRCDIR/corelib/style/mstylesheetattribute.cpp + HEADERS += \ ft_mstylesheetparser.h \ $$MSRCDIR/corelib/theme/mlogicalvalues.h \ - $$MSRCDIR/corelib/style/muniquestringcache.h \ - $$MSRCDIR/corelib/style/mstylesheetattribute.h \ + $$MSRCDIR/corelib/style/mstylesheetattribute.h support_files.files += \ *.css \ diff --git a/tests/ut_mlogicalvalues/ut_mlogicalvalues.pro b/tests/ut_mlogicalvalues/ut_mlogicalvalues.pro index a8366e99..a47f1440 100644 --- a/tests/ut_mlogicalvalues/ut_mlogicalvalues.pro +++ b/tests/ut_mlogicalvalues/ut_mlogicalvalues.pro @@ -8,16 +8,13 @@ INCLUDEPATH += $$MSRCDIR/corelib/core/ SOURCES += \ ut_mlogicalvalues.cpp \ $$MSRCDIR/corelib/theme/mlogicalvalues.cpp \ - $$MSRCDIR/corelib/style/mstylesheetattribute.cpp \ - $$MSRCDIR/corelib/style/muniquestringcache.cpp + $$MSRCDIR/corelib/style/mstylesheetattribute.cpp HEADERS += \ ut_mlogicalvalues.h \ $$MSRCDIR/corelib/theme/mlogicalvalues.h \ $$MSRCDIR/corelib/theme/mlogicalvalues_p.h \ - $$MSRCDIR/corelib/style/mstylesheetattribute.h \ - $$MSRCDIR/corelib/style/muniquestringcache.h - + $$MSRCDIR/corelib/style/mstylesheetattribute.h support_files.files += *.ini |