From 826f28e64dfe496a211b03a2419cb71e33ed788b Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Wed, 15 May 2013 11:22:26 +0200 Subject: [PATCH] sd unittests: Update XShapeDumper to dump also (some) font properties. + update the expected dumps together with that. This allows testing of the other part (wrong text color and size, commit 55c63ccfd460895af22e91979967cec15d80b72d) of n#758621 too. Change-Id: Ie93feb9d9d05eb4e11106bf9aa1f237947351b4e --- drawinglayer/source/dumper/XShapeDumper.cxx | 56 ++++++- sd/qa/unit/data/pptx/xml/fdo47434_page0.xml | 32 ++-- sd/qa/unit/data/xml/fdo64586_0.xml | 16 +- sd/qa/unit/data/xml/n758621_0.xml | 16 +- sd/qa/unit/data/xml/n758621_1.xml | 16 +- sd/qa/unit/data/xml/shapes-test_page0.xml | 176 ++++++++++---------- sd/qa/unit/data/xml/shapes-test_page1.xml | 96 +++++------ sd/qa/unit/data/xml/shapes-test_page2.xml | 144 ++++++++-------- sd/qa/unit/data/xml/shapes-test_page3.xml | 64 +++---- sd/qa/unit/data/xml/shapes-test_page4.xml | 40 ++--- sd/qa/unit/data/xml/shapes-test_page5.xml | 32 ++-- sd/qa/unit/data/xml/shapes-test_page7.xml | 2 +- 12 files changed, 367 insertions(+), 323 deletions(-) diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx index 958bc1521172..d3f50abf302d 100644 --- a/drawinglayer/source/dumper/XShapeDumper.cxx +++ b/drawinglayer/source/dumper/XShapeDumper.cxx @@ -84,6 +84,11 @@ void dumpPolygonKindAsAttribute(com::sun::star::drawing::PolygonKind ePolygonKin void dumpPolyPolygonAsElement(com::sun::star::drawing::PointSequenceSequence aPolyPolygon, xmlTextWriterPtr xmlWriter); void dumpGeometryAsElement(com::sun::star::drawing::PointSequenceSequence aGeometry, xmlTextWriterPtr xmlWriter); +// CharacterProperties.idl +void dumpCharFontNameAsAttribute(OUString aCharFontName, xmlTextWriterPtr xmlWriter); +void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter); +void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter); + // TextProperties.idl void dumpIsNumberingAsAttribute(sal_Bool bIsNumbering, xmlTextWriterPtr xmlWriter); void dumpTextAutoGrowHeightAsAttribute(sal_Bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter); @@ -195,7 +200,7 @@ void dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle, xmlTextWriterPtr xm void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter) { - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%" SAL_PRIdINT32, aColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%06x", (unsigned int) aColor); } void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter) @@ -235,8 +240,8 @@ void dumpGradientProperty(awt::Gradient aGradient, xmlTextWriterPtr xmlWriter) default: break; } - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startColor"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.StartColor); - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endColor"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.EndColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startColor"), "%06x", (unsigned int) aGradient.StartColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endColor"), "%06x", (unsigned int) aGradient.EndColor); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.Angle); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("border"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.Border); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("xOffset"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.XOffset); @@ -283,7 +288,7 @@ void dumpFillHatchAsElement(drawing::Hatch aHatch, xmlTextWriterPtr xmlWriter) default: break; } - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Color); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%06x", (unsigned int) aHatch.Color); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Distance); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Angle); xmlTextWriterEndElement( xmlWriter ); @@ -481,7 +486,7 @@ void dumpLineDashNameAsAttribute(OUString sLineDashName, xmlTextWriterPtr xmlWri void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter) { - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%" SAL_PRIdINT32, aLineColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%06x", (unsigned int) aLineColor); } void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter) @@ -679,6 +684,22 @@ void dumpGeometryAsElement(drawing::PointSequenceSequence aGeometry, xmlTextWrit xmlTextWriterEndElement( xmlWriter ); } +// CharacterProperties.idl +void dumpCharFontNameAsAttribute(OUString aCharFontName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontName"), "%s", OUStringToOString( aCharFontName, RTL_TEXTENCODING_UTF8 ).getStr() ); +} + +void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontHeight"), "%f", fHeight ); +} + +void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fontColor"), "%06x", (unsigned int) aColor); +} + // ---------------------------------------- // ---------- TextProperties.idl ---------- // ---------------------------------------- @@ -926,7 +947,7 @@ void dumpShadowAsAttribute(sal_Bool bShadow, xmlTextWriterPtr xmlWriter) void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter) { - xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%" SAL_PRIdINT32, aShadowColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%06x", (unsigned int) aShadowColor); } void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter) @@ -1124,6 +1145,29 @@ void dumpCustomShapeReplacementURLAsAttribute(OUString sCustomShapeReplacementUR void dumpTextPropertiesService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) { uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + if(xInfo->hasPropertyByName("CharFontName")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("CharFontName"); + OUString aCharFontName; + if(anotherAny >>= aCharFontName) + dumpCharFontNameAsAttribute(aCharFontName, xmlWriter); + } + if(xInfo->hasPropertyByName("CharHeight")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("CharHeight"); + float fHeight; + if(anotherAny >>= fHeight) + dumpCharHeightAsAttribute(fHeight, xmlWriter); + } + if(xInfo->hasPropertyByName("CharColor")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("CharColor"); + sal_Int32 aColor = sal_Int32(); + if(anotherAny >>= aColor) + dumpCharColorAsAttribute(aColor, xmlWriter); + } + // TODO - more properties from CharacterProperties.idl (similar to above) + if(xInfo->hasPropertyByName("IsNumbering")) { uno::Any anotherAny = xPropSet->getPropertyValue("IsNumbering"); diff --git a/sd/qa/unit/data/pptx/xml/fdo47434_page0.xml b/sd/qa/unit/data/pptx/xml/fdo47434_page0.xml index 67d1c16ad4e6..ccec556c20e0 100644 --- a/sd/qa/unit/data/pptx/xml/fdo47434_page0.xml +++ b/sd/qa/unit/data/pptx/xml/fdo47434_page0.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -34,10 +34,10 @@ - - - - + + + + @@ -68,10 +68,10 @@ - - - - + + + + @@ -102,10 +102,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/fdo64586_0.xml b/sd/qa/unit/data/xml/fdo64586_0.xml index 695fbd9ef167..d330797bd5a8 100644 --- a/sd/qa/unit/data/xml/fdo64586_0.xml +++ b/sd/qa/unit/data/xml/fdo64586_0.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -14,10 +14,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/n758621_0.xml b/sd/qa/unit/data/xml/n758621_0.xml index fe2e15652e08..0674dfeb58b8 100644 --- a/sd/qa/unit/data/xml/n758621_0.xml +++ b/sd/qa/unit/data/xml/n758621_0.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -14,10 +14,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/n758621_1.xml b/sd/qa/unit/data/xml/n758621_1.xml index a76af22f6c82..6848b1432d56 100644 --- a/sd/qa/unit/data/xml/n758621_1.xml +++ b/sd/qa/unit/data/xml/n758621_1.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -14,10 +14,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/shapes-test_page0.xml b/sd/qa/unit/data/xml/shapes-test_page0.xml index 5ef6d591626b..3edcd365aec2 100644 --- a/sd/qa/unit/data/xml/shapes-test_page0.xml +++ b/sd/qa/unit/data/xml/shapes-test_page0.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -20,10 +20,10 @@ - - - - + + + + @@ -42,10 +42,10 @@ - - - - + + + + @@ -62,10 +62,10 @@ - - - - + + + + @@ -84,10 +84,10 @@ - - - - + + + + @@ -104,10 +104,10 @@ - - - - + + + + @@ -124,10 +124,10 @@ - - - - + + + + @@ -145,10 +145,10 @@ - - - - + + + + @@ -167,10 +167,10 @@ - - - - + + + + @@ -187,10 +187,10 @@ - - - - + + + + @@ -209,10 +209,10 @@ - - - - + + + + @@ -229,10 +229,10 @@ - - - - + + + + @@ -251,10 +251,10 @@ - - - - + + + + @@ -271,10 +271,10 @@ - - - - + + + + @@ -293,10 +293,10 @@ - - - - + + + + @@ -315,10 +315,10 @@ - - - - + + + + @@ -337,10 +337,10 @@ - - - - + + + + @@ -359,10 +359,10 @@ - - - - + + + + @@ -381,10 +381,10 @@ - - - - + + + + @@ -403,10 +403,10 @@ - - - - + + + + @@ -425,10 +425,10 @@ - - - - + + + + @@ -447,10 +447,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/shapes-test_page1.xml b/sd/qa/unit/data/xml/shapes-test_page1.xml index 3f7e2c613a5f..8981ad0474f3 100644 --- a/sd/qa/unit/data/xml/shapes-test_page1.xml +++ b/sd/qa/unit/data/xml/shapes-test_page1.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -20,10 +20,10 @@ - - - - + + + + @@ -42,10 +42,10 @@ - - - - + + + + @@ -62,10 +62,10 @@ - - - - + + + + @@ -82,10 +82,10 @@ - - - - + + + + @@ -104,10 +104,10 @@ - - - - + + + + @@ -124,10 +124,10 @@ - - - - + + + + @@ -146,10 +146,10 @@ - - - - + + + + @@ -166,10 +166,10 @@ - - - - + + + + @@ -188,10 +188,10 @@ - - - - + + + + @@ -210,10 +210,10 @@ - - - - + + + + @@ -230,10 +230,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/shapes-test_page2.xml b/sd/qa/unit/data/xml/shapes-test_page2.xml index 652dc07d1996..22adeea46fda 100644 --- a/sd/qa/unit/data/xml/shapes-test_page2.xml +++ b/sd/qa/unit/data/xml/shapes-test_page2.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -22,10 +22,10 @@ - - - - + + + + @@ -44,10 +44,10 @@ - - - - + + + + @@ -67,10 +67,10 @@ - - - - + + + + @@ -87,10 +87,10 @@ - - - - + + + + @@ -109,10 +109,10 @@ - - - - + + + + @@ -129,10 +129,10 @@ - - - - + + + + @@ -149,10 +149,10 @@ - - - - + + + + @@ -171,10 +171,10 @@ - - - - + + + + @@ -191,10 +191,10 @@ - - - - + + + + @@ -213,10 +213,10 @@ - - - - + + + + @@ -235,10 +235,10 @@ - - - - + + + + @@ -257,10 +257,10 @@ - - - - + + + + @@ -279,10 +279,10 @@ - - - - + + + + @@ -301,10 +301,10 @@ - - - - + + + + @@ -323,10 +323,10 @@ - - - - + + + + @@ -345,10 +345,10 @@ - - - - + + + + @@ -367,10 +367,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/shapes-test_page3.xml b/sd/qa/unit/data/xml/shapes-test_page3.xml index 643defae2c03..025d63008537 100644 --- a/sd/qa/unit/data/xml/shapes-test_page3.xml +++ b/sd/qa/unit/data/xml/shapes-test_page3.xml @@ -1,6 +1,6 @@ - + @@ -22,7 +22,7 @@ - + @@ -44,10 +44,10 @@ - - - - + + + + @@ -192,7 +192,7 @@ - + @@ -221,10 +221,10 @@ - - - - + + + + @@ -419,10 +419,10 @@ - - - - + + + + @@ -477,7 +477,7 @@ - + @@ -505,10 +505,10 @@ - - - - + + + + @@ -569,10 +569,10 @@ - - - - + + + + @@ -603,10 +603,10 @@ - - - - + + + + @@ -653,10 +653,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/shapes-test_page4.xml b/sd/qa/unit/data/xml/shapes-test_page4.xml index db90eb929131..ef46e4b81c68 100644 --- a/sd/qa/unit/data/xml/shapes-test_page4.xml +++ b/sd/qa/unit/data/xml/shapes-test_page4.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -24,10 +24,10 @@ - - - - + + + + @@ -48,10 +48,10 @@ - - - - + + + + @@ -70,10 +70,10 @@ - - - - + + + + @@ -92,10 +92,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/shapes-test_page5.xml b/sd/qa/unit/data/xml/shapes-test_page5.xml index 311cff47f40f..23f64734b3d3 100644 --- a/sd/qa/unit/data/xml/shapes-test_page5.xml +++ b/sd/qa/unit/data/xml/shapes-test_page5.xml @@ -1,9 +1,9 @@ - - - - + + + + @@ -22,10 +22,10 @@ - - - - + + + + @@ -44,10 +44,10 @@ - - - - + + + + @@ -66,10 +66,10 @@ - - - - + + + + diff --git a/sd/qa/unit/data/xml/shapes-test_page7.xml b/sd/qa/unit/data/xml/shapes-test_page7.xml index 3170a3bb3e9c..a72eb0463a8f 100644 --- a/sd/qa/unit/data/xml/shapes-test_page7.xml +++ b/sd/qa/unit/data/xml/shapes-test_page7.xml @@ -1,6 +1,6 @@ - +