diff options
Diffstat (limited to 'svx/qa/unit/svdraw.cxx')
-rw-r--r-- | svx/qa/unit/svdraw.cxx | 119 |
1 files changed, 60 insertions, 59 deletions
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index 1284fa6305bf..8a6a39892b9d 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -123,7 +123,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText) // - XPath '//unifiedtransparence' number of nodes is incorrect // i.e. the text was just plain red, not semi-transparent. sal_Int16 fTransparence - = getXPath(pDocument, "//unifiedtransparence", "transparence").toInt32(); + = getXPath(pDocument, "//unifiedtransparence"_ostr, "transparence"_ostr).toInt32(); CPPUNIT_ASSERT_EQUAL(nTransparence, fTransparence); } @@ -288,40 +288,40 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObject) drawinglayer::Primitive2dXmlDump aDumper; xmlDocUniquePtr pXmlDoc = aDumper.dumpAndParse(xPrimitiveSequence); - assertXPath(pXmlDoc, "/primitive2D", 1); + assertXPath(pXmlDoc, "/primitive2D"_ostr, 1); - OString aBasePath("/primitive2D/sdrrectangle/polypolygoncolor"); - assertXPath(pXmlDoc, aBasePath, "color", "#729fcf"); + OString aBasePath("/primitive2D/sdrrectangle/polypolygoncolor"_ostr); + assertXPath(pXmlDoc, aBasePath, "color"_ostr, "#729fcf"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "height", + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "height"_ostr, "99"); // weird Rectangle is created with size 100 - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "width", "99"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "minx", "0"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "miny", "0"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxx", "99"); - assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxy", "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "width"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "minx"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "miny"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxx"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/polypolygon", "maxy"_ostr, "99"); aBasePath = "/primitive2D/sdrrectangle/polypolygoncolor/polypolygon/polygon"; assertXPath(pXmlDoc, aBasePath + "/point", 5); - assertXPath(pXmlDoc, aBasePath + "/point[1]", "x", "49.5"); // hmm, weird, why? - assertXPath(pXmlDoc, aBasePath + "/point[1]", "y", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[2]", "x", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[2]", "y", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[3]", "x", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[3]", "y", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[4]", "x", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[4]", "y", "0"); - assertXPath(pXmlDoc, aBasePath + "/point[5]", "x", "99"); - assertXPath(pXmlDoc, aBasePath + "/point[5]", "y", "99"); + assertXPath(pXmlDoc, aBasePath + "/point[1]", "x"_ostr, "49.5"); // hmm, weird, why? + assertXPath(pXmlDoc, aBasePath + "/point[1]", "y"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[2]", "x"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[2]", "y"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[3]", "x"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[3]", "y"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[4]", "x"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[4]", "y"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/point[5]", "x"_ostr, "99"); + assertXPath(pXmlDoc, aBasePath + "/point[5]", "y"_ostr, "99"); aBasePath = "/primitive2D/sdrrectangle/polygonstroke"; assertXPath(pXmlDoc, aBasePath, 1); - assertXPath(pXmlDoc, aBasePath + "/line", "color", "#3465a4"); - assertXPath(pXmlDoc, aBasePath + "/line", "width", "0"); - assertXPath(pXmlDoc, aBasePath + "/line", "linejoin", "Round"); - assertXPath(pXmlDoc, aBasePath + "/line", "linecap", "BUTT"); + assertXPath(pXmlDoc, aBasePath + "/line", "color"_ostr, "#3465a4"); + assertXPath(pXmlDoc, aBasePath + "/line", "width"_ostr, "0"); + assertXPath(pXmlDoc, aBasePath + "/line", "linejoin"_ostr, "Round"); + assertXPath(pXmlDoc, aBasePath + "/line", "linecap"_ostr, "BUTT"); assertXPathContent(pXmlDoc, aBasePath + "/polygon", "49.5,99 0,99 0,0 99,0 99,99"); @@ -373,14 +373,15 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks) SdrPage* pSdrPage = pDrawPage->GetSdrPage(); xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); - assertXPath(pXmlDoc, "/primitive2D", 1); + assertXPath(pXmlDoc, "/primitive2D"_ostr, 1); - assertXPath(pXmlDoc, "//scene", "projectionMode", "Perspective"); - assertXPath(pXmlDoc, "//scene/extrude3D[1]/fill", "color", "#ff0000"); - assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", "color", "#ff0000"); + assertXPath(pXmlDoc, "//scene"_ostr, "projectionMode"_ostr, "Perspective"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/fill"_ostr, "color"_ostr, "#ff0000"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material"_ostr, "color"_ostr, + "#ff0000"); // ODF default 50% is represented by Specular Intensity = 2^5. The relationship is not linear. - assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material", "specularIntensity", - "32"); + assertXPath(pXmlDoc, "//scene/extrude3D[1]/object3Dattributes/material"_ostr, + "specularIntensity"_ostr, "32"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) @@ -399,13 +400,13 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTdf148000_EOLinCurvedText) // this is a group shape, hence 2 nested objectinfo OString aBasePath = "/primitive2D/objectinfo[4]/objectinfo/unhandled/unhandled/" - "polypolygoncolor/polypolygon/"; + "polypolygoncolor/polypolygon/"_ostr; // The text is: "O" + eop + "O" + eol + "O" // It should be displayed as 3 line of text. (1 "O" letter in every line) - sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y").toInt32(); - sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3]/point[1]", "y").toInt32(); - sal_Int32 nY3 = getXPath(pXmlDoc, aBasePath + "polygon[5]/point[1]", "y").toInt32(); + sal_Int32 nY1 = getXPath(pXmlDoc, aBasePath + "polygon[1]/point[1]", "y"_ostr).toInt32(); + sal_Int32 nY2 = getXPath(pXmlDoc, aBasePath + "polygon[3]/point[1]", "y"_ostr).toInt32(); + sal_Int32 nY3 = getXPath(pXmlDoc, aBasePath + "polygon[5]/point[1]", "y"_ostr).toInt32(); sal_Int32 nDiff21 = nY2 - nY1; sal_Int32 nDiff32 = nY3 - nY2; @@ -437,9 +438,9 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMetal) // ODF specifies for metal = true specular color as rgb(200,200,200) and adding 15 to specularity // Together with extrusion-first-light-level 67% and extrusion-specularity 80% factor is // 0.67*0.8 * 200/255 = 0.42 and color #6b6b6b - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#6b6b6b"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#6b6b6b"); // 3D specularIntensity = 2^(50/10) + 15 = 47, with default extrusion-shininess 50% - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "47"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "47"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testExtrusionPhong) @@ -451,8 +452,8 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testExtrusionPhong) xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage); // The rendering method and normals kind were always 'Flat' without the patch. - assertXPath(pXmlDoc, "//scene", "shadeMode", "Phong"); - assertXPath(pXmlDoc, "//object3Dattributes", "normalsKind", "Specific"); + assertXPath(pXmlDoc, "//scene"_ostr, "shadeMode"_ostr, "Phong"); + assertXPath(pXmlDoc, "//object3Dattributes"_ostr, "normalsKind"_ostr, "Specific"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMattePPT) @@ -469,14 +470,14 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSurfaceMattePPT) // to forth light, as only first light is specular. Because first and third lights are off, the // forth light is the second one in the dump. The gray color corresponding to // FirstLightLevel = 38000/2^16 is #949494. - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#000000"); - assertXPath(pXmlDoc, "(//light)[2]", "color", "#949494"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#000000"); + assertXPath(pXmlDoc, "(//light)[2]"_ostr, "color"_ostr, "#949494"); // To make the second light soft, part of its intensity is moved to lights 5,6,7 and 8. - assertXPath(pXmlDoc, "(//light)[1]", "color", "#1e1e1e"); - assertXPath(pXmlDoc, "(//light)[3]", "color", "#3b3b3b"); + assertXPath(pXmlDoc, "(//light)[1]"_ostr, "color"_ostr, "#1e1e1e"); + assertXPath(pXmlDoc, "(//light)[3]"_ostr, "color"_ostr, "#3b3b3b"); // The 3D property specularIntensity is not related to 'extrusion-specularity' but to // 'extrusion-shininess'. specularIntensity = 2^(shininess/10), here default 32. - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "32"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "32"); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular) @@ -492,13 +493,13 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testMaterialSpecular) // -level'. 3D specularIntensity is derived from property 'draw:extrusion-shininess'. Both are // object properties, not scene properties. Those were wrong in various forms before the patch. // Specularity = 77% * first-light-level 67% = 0.5159, which corresponds to gray color #848484. - assertXPath(pXmlDoc, "(//material)[1]", "specular", "#848484"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specular"_ostr, "#848484"); // extrusion-shininess 50% corresponds to 3D specularIntensity 32, use 2^(50/10). - assertXPath(pXmlDoc, "(//material)[1]", "specularIntensity", "32"); + assertXPath(pXmlDoc, "(//material)[1]"_ostr, "specularIntensity"_ostr, "32"); // extrusion-first-light-level 67% corresponds to gray color #ababab, use 255 * 0.67. - assertXPath(pXmlDoc, "(//light)[1]", "color", "#ababab"); + assertXPath(pXmlDoc, "(//light)[1]"_ostr, "color"_ostr, "#ababab"); // The first light is harsh, the second light soft. So the 3D scene should have 6 lights (1+1+4). - assertXPath(pXmlDoc, "//light", 6); + assertXPath(pXmlDoc, "//light"_ostr, 6); } CPPUNIT_TEST_FIXTURE(SvdrawTest, testVideoSnapshot) @@ -692,27 +693,27 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testClipVerticalTextOverflow) // - In <>, XPath contents of child does not match // i.e. the vertically overflowing text wasn't clipped & overflowing text // was drawn anyways. - assertXPathContent(pDocument, "count((//sdrblocktext)[4]//textsimpleportion)", "6"); + assertXPathContent(pDocument, "count((//sdrblocktext)[4]//textsimpleportion)"_ostr, "6"); // make sure text is aligned correctly after the overflowing text is clipped - assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[1]", "y", "3749"); - assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[6]", "y", "7559"); + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[1]"_ostr, "y"_ostr, "3749"); + assertXPath(pDocument, "((//sdrblocktext)[4]//textsimpleportion)[6]"_ostr, "y"_ostr, "7559"); // make sure the text that isn't overflowing is still aligned properly - assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)", "3"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]", "y", "5073"); - assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]", "y", "6597"); + assertXPathContent(pDocument, "count((//sdrblocktext)[5]//textsimpleportion)"_ostr, "3"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[1]"_ostr, "y"_ostr, "5073"); + assertXPath(pDocument, "((//sdrblocktext)[5]//textsimpleportion)[3]"_ostr, "y"_ostr, "6597"); // Test vertically overflowing text, with vertical text direction - assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)", "12"); + assertXPathContent(pDocument, "count((//sdrblocktext)[6]//textsimpleportion)"_ostr, "12"); // make sure text is aligned correctly after the overflowing text is clipped - assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[1]", "x", "13093"); - assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[12]", "x", "4711"); + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[1]"_ostr, "x"_ostr, "13093"); + assertXPath(pDocument, "((//sdrblocktext)[6]//textsimpleportion)[12]"_ostr, "x"_ostr, "4711"); // make sure the text that isn't overflowing is still aligned properly - assertXPathContent(pDocument, "count((//sdrblocktext)[7]//textsimpleportion)", "3"); - assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]", "x", "25417"); - assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]", "x", "23893"); + assertXPathContent(pDocument, "count((//sdrblocktext)[7]//textsimpleportion)"_ostr, "3"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[1]"_ostr, "x"_ostr, "25417"); + assertXPath(pDocument, "((//sdrblocktext)[7]//textsimpleportion)[3]"_ostr, "x"_ostr, "23893"); } } |