diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-01-27 16:45:22 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-01-27 23:24:42 +0100 |
commit | aa2064c5c5f23f6f4b7bc44e12345b37f66995bc (patch) | |
tree | a5073b6d0b0c5846575671975341f0e0b393d98d /sw/qa/extras | |
parent | 686582b4890f458b6b8ee0e1ab19d9ad64793c85 (diff) |
Improve loplugin:stringliteralvar
...to also consider O[U]String ctors taking pointer and length
Change-Id: Iea5041634bfbf5054a1317701e30b56f72e940fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110025
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 7 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 18 |
3 files changed, 14 insertions, 15 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 626157e803dd..45f9a46000e1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -881,10 +881,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf65955_2, "tdf65955_2.odt") DECLARE_OOXMLEXPORT_TEST(testChtOutlineNumberingOoxml, "chtoutline.docx") { - const sal_Unicode aExpectedNumbering[] = { 0x7b2c, ' ', '1', ' ', 0x7ae0 }; + static constexpr OUStringLiteral aExpectedNumbering = u"\u7b2c 1 \u7ae0"; uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering,SAL_N_ELEMENTS(aExpectedNumbering)), + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering), getProperty<OUString>(xPara, "ListLabelString")); } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index b0589b913248..f7114235cc77 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -669,10 +669,9 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129912, "tdf129912.docx") // the expected footnote labels // TODO: the 5th label is actually wrong (missing the "PR" after the symbol part), but the "b" is there?! - const sal_Unicode pLabel5[] = { u'\xF0D1', u'\xF031', u'\xF032', u'\x0062' }; - const OUString sFootnoteLabels[] = { - OUString(u'\xF0A7'), "1", "2", OUString(u'\xF020'), { pLabel5, SAL_N_ELEMENTS(pLabel5) } - }; + static constexpr OUStringLiteral pLabel5 = u"\uF0D1\uF031\uF032b"; + const OUString sFootnoteLabels[] + = { OUString(u'\xF0A7'), "1", "2", OUString(u'\xF020'), pLabel5 }; CPPUNIT_ASSERT_EQUAL(sal_Int32(SAL_N_ELEMENTS(sFootnoteLabels)), nCount); pWrtShell->GotoPrevFootnoteAnchor(); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 4749fa3acf6f..ae99eab0d49a 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1093,10 +1093,10 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext1) load(mpTestDocumentPath, "cp950listleveltext1.rtf"); // suffix with Chinese only ( most common case generated by MSO2010 TC) // This is a dot that is generally used as suffix of Chinese list number - const sal_Unicode aExpectedNumbering[] = { 0x4e00, 0x3001 }; + static constexpr OUStringLiteral aExpectedNumbering = u"\u4e00\u3001"; uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering), getProperty<OUString>(xPara, "ListLabelString")); } @@ -1105,10 +1105,10 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext2) { load(mpTestDocumentPath, "cp950listleveltext2.rtf"); // Prefix and suffix with Chinese only ( tweaked from default in MSO2010 TC) - const sal_Unicode aExpectedNumbering[] = { 0x524d, 0x7f6e, 0x7532, 0x3001, 0x5f8c, 0x7f6e }; + static constexpr OUStringLiteral aExpectedNumbering = u"\u524d\u7f6e\u7532\u3001\u5f8c\u7f6e"; uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering), getProperty<OUString>(xPara, "ListLabelString")); } @@ -1117,11 +1117,11 @@ CPPUNIT_TEST_FIXTURE(Test, testCp950listleveltext3) { load(mpTestDocumentPath, "cp950listleveltext3.rtf"); // 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 }; + static constexpr OUStringLiteral aExpectedNumbering = u"\u524da\u7f6eb\u7532\u3001" + "c\u5f8cd\u7f6ee"; uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering), getProperty<OUString>(xPara, "ListLabelString")); } @@ -1129,10 +1129,10 @@ CPPUNIT_TEST_FIXTURE(Test, testChtOutlineNumberingRtf) { load(mpTestDocumentPath, "chtoutline.rtf"); - const sal_Unicode aExpectedNumbering[] = { 0x7b2c, ' ', '1', ' ', 0x7ae0 }; + static constexpr OUStringLiteral aExpectedNumbering = u"\u7b2c 1 \u7ae0"; uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering, SAL_N_ELEMENTS(aExpectedNumbering)), + CPPUNIT_ASSERT_EQUAL(OUString(aExpectedNumbering), getProperty<OUString>(xPara, "ListLabelString")); } |