diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-06-15 12:45:32 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-06-15 13:37:08 +0200 |
commit | 6ada0b8f71eb9a5b0cf2d8d3e323727f8925a491 (patch) | |
tree | 03b914a5d571111bfaad9b5dc576f3a88bb4d47e /sw | |
parent | 90d6e8c63f0ae4ce0d76da2ae38ce65ecd450c95 (diff) |
fdo#58819 testcase
Change-Id: I94c5a92db38c929a0c8b15e7906a941e39594017
Diffstat (limited to 'sw')
-rwxr-xr-x | sw/qa/extras/ooxmlexport/data/watermark.docx (renamed from sw/qa/extras/ooxmlimport/data/watermark.docx) | bin | 14766 -> 14766 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 36 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 26 |
3 files changed, 35 insertions, 27 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/watermark.docx b/sw/qa/extras/ooxmlexport/data/watermark.docx Binary files differindex 8e279e3e857f..8e279e3e857f 100755 --- a/sw/qa/extras/ooxmlimport/data/watermark.docx +++ b/sw/qa/extras/ooxmlexport/data/watermark.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 024e31715130..d6812f07fbc0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -9,10 +9,12 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/XTextFrame.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp> @@ -76,6 +78,8 @@ public: void testFdo65265(); void testFdo65655(); void testFDO63053(); + void testWatermark(); + CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(run); @@ -128,7 +132,7 @@ void Test::run() {"fdo65265.docx", &Test::testFdo65265}, {"fdo65655.docx", &Test::testFdo65655}, {"fdo63053.docx" , &Test::testFDO63053}, - + {"watermark.docx", &Test::testWatermark}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -737,6 +741,36 @@ void Test::testFDO63053() CPPUNIT_ASSERT_EQUAL(OUString("test1&test2"), xDocumentProperties->getSubject()); } +void Test::testWatermark() +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xShape(xDraws->getByIndex(0), uno::UNO_QUERY); + // 1st problem: last character was missing + CPPUNIT_ASSERT_EQUAL(OUString("SAMPLE"), xShape->getString()); + + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry"); + bool bFound = false; + for (int i = 0; i < aProps.getLength(); ++i) + if (aProps[i].Name == "TextPath") + bFound = true; + // 2nd problem: v:textpath wasn't imported + CPPUNIT_ASSERT_EQUAL(true, bFound); + + // 3rd problem: rotation angle was 315, not 45. + CPPUNIT_ASSERT_EQUAL(sal_Int32(45 * 100), getProperty<sal_Int32>(xShape, "RotateAngle")); + + // 4th problem: mso-position-vertical-relative:margin was ignored, VertOrientRelation was text::RelOrientation::FRAME. + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); + + // These problems were in the exporter + // The textpath wasn't semi-transparent. + CPPUNIT_ASSERT_EQUAL(sal_Int16(50), getProperty<sal_Int16>(xShape, "FillTransparence")); + // The textpath had a stroke. + CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xShape, "LineStyle")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index b1fc3d5c4ba2..c0987d16c7d7 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -114,7 +114,6 @@ public: void testN592908_Picture(); void testN779630(); void testIndentation(); - void testWatermark(); void testPageBorderShadow(); void testN816593(); void testN820509(); @@ -200,7 +199,6 @@ void Test::run() {"n592908-picture.docx", &Test::testN592908_Picture}, {"n779630.docx", &Test::testN779630}, {"indentation.docx", &Test::testIndentation}, - {"watermark.docx", &Test::testWatermark}, {"page-border-shadow.docx", &Test::testPageBorderShadow}, {"n816593.docx", &Test::testN816593}, {"n820509.docx", &Test::testN820509}, @@ -1394,30 +1392,6 @@ void Test::testIndentation() CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, getProperty<sal_Int16>(xPropertySet, "WritingMode")); } -void Test::testWatermark() -{ - uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xShape(xDraws->getByIndex(0), uno::UNO_QUERY); - // 1st problem: last character was missing - CPPUNIT_ASSERT_EQUAL(OUString("SAMPLE"), xShape->getString()); - - uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry"); - bool bFound = false; - for (int i = 0; i < aProps.getLength(); ++i) - if (aProps[i].Name == "TextPath") - bFound = true; - // 2nd problem: v:textpath wasn't imported - CPPUNIT_ASSERT_EQUAL(true, bFound); - - // 3rd problem: rotation angle was 315, not 45. - CPPUNIT_ASSERT_EQUAL(sal_Int32(45 * 100), getProperty<sal_Int32>(xShape, "RotateAngle")); - - // 4th problem: mso-position-vertical-relative:margin was ignored, VertOrientRelation was text::RelOrientation::FRAME. - CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); -} - void Test::testPageBorderShadow() { // The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored. |