diff options
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 5 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 22 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 156 |
4 files changed, 74 insertions, 117 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index cced1b33e2ba..0b142d51141a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -765,7 +765,10 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx") { uno::Reference<container::XIndexAccess> xRules = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); // This was 1, i.e. the numbering on the second level was "1", not "1.1". - CPPUNIT_ASSERT_EQUAL(sal_Int16(2), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["ParentNumbering"].get<sal_Int16>()); + // Check the praragraph properties, not the list ones, since they can differ due to overrides + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty<OUString>(xPara, "ListLabelString")); // The paragraph marker's red font color was inherited by the number portion, this was ff0000. CPPUNIT_ASSERT_EQUAL(OUString("ffffffff"), parseDump("//Special[@nType='PortionType::Number']/SwFont", "color")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 3e0d3752187f..d8eafc1d60b1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -858,25 +858,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf65955_2, "tdf65955_2.odt") DECLARE_OOXMLEXPORT_TEST(testChtOutlineNumberingOoxml, "chtoutline.docx") { - const sal_Unicode aExpectedPrefix[2] = { 0x7b2c, 0x0020 }; - const sal_Unicode aExpectedSuffix[2] = { 0x0020, 0x7ae0 }; - uno::Reference< text::XChapterNumberingSupplier > xChapterNumberingSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference< container::XIndexAccess> xLevels(xChapterNumberingSupplier->getChapterNumberingRules()); - uno::Sequence<beans::PropertyValue> aProps; - xLevels->getByIndex(0) >>= aProps; // 1st level - - OUString aSuffix,aPrefix; - for (int i = 0; i < aProps.getLength(); ++i) - { - const beans::PropertyValue& rProp = aProps[i]; + const sal_Unicode aExpectedNumbering[] = { 0x7b2c, ' ', '1', ' ', 0x7ae0 }; - if (rProp.Name == "Suffix") - aSuffix = rProp.Value.get<OUString>(); - if (rProp.Name == "Prefix") - aPrefix = rProp.Value.get<OUString>(); - } - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix,SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix,SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering,SAL_N_ELEMENTS(aExpectedNumbering)), + getProperty<OUString>(xPara, "ListLabelString")); } DECLARE_OOXMLEXPORT_TEST(mathtype, "mathtype.docx") diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index cf2cb780bb12..535374da8863 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -659,16 +659,16 @@ DECLARE_RTFEXPORT_TEST(testFdo66682, "fdo66682.rtf") uno::Sequence<beans::PropertyValue> aProps; xLevels->getByIndex(0) >>= aProps; // 1st level - OUString aSuffix; + OUString aListFormat; for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; - if (rProp.Name == "Suffix") - aSuffix = rProp.Value.get<OUString>(); + if (rProp.Name == "ListFormat") + aListFormat = rProp.Value.get<OUString>(); } // Suffix was '\0' instead of ' '. - CPPUNIT_ASSERT_EQUAL(OUString(" "), aSuffix); + CPPUNIT_ASSERT_EQUAL(OUString(" %1 "), aListFormat); } DECLARE_RTFEXPORT_TEST(testParaShadow, "para-shadow.rtf") diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index f9d4e3cbdb6e..08d7d647c167 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -141,21 +141,52 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108943) CPPUNIT_TEST_FIXTURE(Test, testFdo46662) { load(mpTestDocumentPath, "fdo46662.rtf"); - uno::Reference<beans::XPropertySet> xPropertySet( - getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels( - xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aProps; - xLevels->getByIndex(1) >>= aProps; // 2nd level - for (int i = 0; i < aProps.getLength(); ++i) + OUString listStyle; + { - const beans::PropertyValue& rProp = aProps[i]; + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), + getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle); + CPPUNIT_ASSERT(listStyle.startsWith("WWNum")); + CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString")); + } + + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(2), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), + getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle); + CPPUNIT_ASSERT(listStyle.startsWith("WWNum")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1"), getProperty<OUString>(xPara, "ListLabelString")); + } + + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(3), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(2), + getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle); + CPPUNIT_ASSERT(listStyle.startsWith("WWNum")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1.1"), getProperty<OUString>(xPara, "ListLabelString")); + } + + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(4), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(3), + getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle); + CPPUNIT_ASSERT(listStyle.startsWith("WWNum")); + CPPUNIT_ASSERT_EQUAL(OUString("1.1.1.1"), getProperty<OUString>(xPara, "ListLabelString")); + } - if (rProp.Name == "ParentNumbering") - CPPUNIT_ASSERT_EQUAL(sal_Int16(2), rProp.Value.get<sal_Int16>()); - else if (rProp.Name == "Suffix") - CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength()); + { + uno::Reference<beans::XPropertySet> xPara(getParagraph(5), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(0), + getProperty<sal_Int16>(xPara, "NumberingLevel")); + CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle); + CPPUNIT_ASSERT(listStyle.startsWith("WWNum")); + CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty<OUString>(xPara, "ListLabelString")); } } @@ -1037,25 +1068,12 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext1) { load(mpTestDocumentPath, "cp950listleveltext1.rtf"); // suffix with Chinese only ( most common case generated by MSO2010 TC) - const sal_Unicode aExpectedSuffix[1] - = { 0x3001 }; // This is a dot that is generally used as suffix of Chinese list number - uno::Reference<beans::XPropertySet> xPropertySet( - getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels( - xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aProps; - xLevels->getByIndex(0) >>= aProps; // 1st level - - OUString aSuffix; - for (int i = 0; i < aProps.getLength(); ++i) - { - const beans::PropertyValue& rProp = aProps[i]; + // This is a dot that is generally used as suffix of Chinese list number + const sal_Unicode aExpectedNumbering[] = { 0x4e00, 0x3001 }; - if (rProp.Name == "Suffix") - aSuffix = rProp.Value.get<OUString>(); - } - // Suffix was '\0' instead of ' '. - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + getProperty<OUString>(xPara, "ListLabelString")); } // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ). @@ -1063,85 +1081,35 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext2) { load(mpTestDocumentPath, "cp950listleveltext2.rtf"); // Prefix and suffix with Chinese only ( tweaked from default in MSO2010 TC) - const sal_Unicode aExpectedPrefix[2] = { 0x524d, 0x7f6e }; - const sal_Unicode aExpectedSuffix[3] = { 0x3001, 0x5f8c, 0x7f6e }; + const sal_Unicode aExpectedNumbering[] = { 0x524d, 0x7f6e, 0x7532, 0x3001, 0x5f8c, 0x7f6e }; - uno::Reference<beans::XPropertySet> xPropertySet( - getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels( - xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aProps; - xLevels->getByIndex(0) >>= aProps; // 1st level - - OUString aSuffix, aPrefix; - for (int i = 0; i < aProps.getLength(); ++i) - { - const beans::PropertyValue& rProp = aProps[i]; - - if (rProp.Name == "Suffix") - aSuffix = rProp.Value.get<OUString>(); - if (rProp.Name == "Prefix") - aPrefix = rProp.Value.get<OUString>(); - } - // Suffix was '\0' instead of ' '. - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix, SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + getProperty<OUString>(xPara, "ListLabelString")); } // This testcase illustrate leveltext with multibyte strings coded in cp950 ( BIG5 ) CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext3) { load(mpTestDocumentPath, "cp950listleveltext3.rtf"); - // Prefix and suffix that mix Chinese and English ( tweaked from default in MSO2010 TC) - const sal_Unicode aExpectedPrefix[4] = { 0x524d, 0x0061, 0x7f6e, 0x0062 }; - const sal_Unicode aExpectedSuffix[6] = { 0x3001, 0x0063, 0x5f8c, 0x0064, 0x7f6e, 0x0065 }; + // Numbering is a mix Chinese and English ( tweaked from default in MSO2010 TC) + const sal_Unicode aExpectedNumbering[] = { 0x524d, 0x0061, 0x7f6e, 0x0062, 0x7532, 0x3001, + 0x0063, 0x5f8c, 0x0064, 0x7f6e, 0x0065 }; - uno::Reference<beans::XPropertySet> xPropertySet( - getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels( - xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aProps; - xLevels->getByIndex(0) >>= aProps; // 1st level - - OUString aSuffix, aPrefix; - for (int i = 0; i < aProps.getLength(); ++i) - { - const beans::PropertyValue& rProp = aProps[i]; - - if (rProp.Name == "Suffix") - aSuffix = rProp.Value.get<OUString>(); - if (rProp.Name == "Prefix") - aPrefix = rProp.Value.get<OUString>(); - } - // Suffix was '\0' instead of ' '. - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix, SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + getProperty<OUString>(xPara, "ListLabelString")); } CPPUNIT_TEST_FIXTURE(Test, testChtOutlineNumberingRtf) { load(mpTestDocumentPath, "chtoutline.rtf"); - const sal_Unicode aExpectedPrefix[2] = { 0x7b2c, 0x0020 }; - const sal_Unicode aExpectedSuffix[2] = { 0x0020, 0x7ae0 }; - uno::Reference<text::XChapterNumberingSupplier> xChapterNumberingSupplier(mxComponent, - uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xLevels( - xChapterNumberingSupplier->getChapterNumberingRules()); - uno::Sequence<beans::PropertyValue> aProps; - xLevels->getByIndex(0) >>= aProps; // 1st level - OUString aSuffix, aPrefix; - for (int i = 0; i < aProps.getLength(); ++i) - { - const beans::PropertyValue& rProp = aProps[i]; + const sal_Unicode aExpectedNumbering[] = { 0x7b2c, ' ', '1', ' ', 0x7ae0 }; - if (rProp.Name == "Suffix") - aSuffix = rProp.Value.get<OUString>(); - if (rProp.Name == "Prefix") - aPrefix = rProp.Value.get<OUString>(); - } - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedPrefix, SAL_N_ELEMENTS(aExpectedPrefix)), aPrefix); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedSuffix, SAL_N_ELEMENTS(aExpectedSuffix)), aSuffix); + uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + getProperty<OUString>(xPara, "ListLabelString")); } CPPUNIT_TEST_FIXTURE(Test, testTdf90046) |