diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-13 14:50:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-14 09:03:47 +0200 |
commit | 320555963d69cbe19570a555a476d0ae757fef98 (patch) | |
tree | 5bf96036078a0136c8c18519499ff86b33406e12 /svl/qa/unit | |
parent | e99991216e47751b80238825aaeb21702d46dc34 (diff) |
loplugin:ostr in svl
Change-Id: Idae670a53d6d9aab0ec7132077f3e7b7f6fa5287
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167595
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/qa/unit')
-rw-r--r-- | svl/qa/unit/items/stylepool.cxx | 22 | ||||
-rw-r--r-- | svl/qa/unit/items/test_IndexedStyleSheets.cxx | 28 | ||||
-rw-r--r-- | svl/qa/unit/lockfiles/test_lockfiles.cxx | 89 | ||||
-rw-r--r-- | svl/qa/unit/svl.cxx | 138 | ||||
-rw-r--r-- | svl/qa/unit/test_INetContentType.cxx | 12 | ||||
-rw-r--r-- | svl/qa/unit/test_SvAddressParser.cxx | 34 | ||||
-rw-r--r-- | svl/qa/unit/test_URIHelper.cxx | 24 | ||||
-rw-r--r-- | svl/qa/unit/test_lngmisc.cxx | 48 |
8 files changed, 197 insertions, 198 deletions
diff --git a/svl/qa/unit/items/stylepool.cxx b/svl/qa/unit/items/stylepool.cxx index 8ba33c1931de..ec82dbd72852 100644 --- a/svl/qa/unit/items/stylepool.cxx +++ b/svl/qa/unit/items/stylepool.cxx @@ -51,59 +51,59 @@ ItemInfoPackage& getItemInfoPackageTest() CPPUNIT_TEST_FIXTURE(StylePoolTest, testIterationOrder) { // Set up a style pool with multiple parents. - rtl::Reference<SfxItemPool> pPool = new SfxItemPool("test"); + rtl::Reference<SfxItemPool> pPool = new SfxItemPool(u"test"_ustr); pPool->registerItemInfoPackage(getItemInfoPackageTest()); { // Set up parents in mixed order to make sure we do not sort by pointer address. SfxItemSet aParent1(*pPool, svl::Items<1, 1>); SfxItemSet aChild1(*pPool, svl::Items<1, 1>); aChild1.SetParent(&aParent1); - SfxStringItem aItem1(1, "Item1"); + SfxStringItem aItem1(1, u"Item1"_ustr); aChild1.Put(aItem1); SfxItemSet aParent3(*pPool, svl::Items<1, 1>); SfxItemSet aChild3(*pPool, svl::Items<1, 1>); aChild3.SetParent(&aParent3); - SfxStringItem aItem3(1, "Item3"); + SfxStringItem aItem3(1, u"Item3"_ustr); aChild3.Put(aItem3); SfxItemSet aParent2(*pPool, svl::Items<1, 1>); SfxItemSet aChild2(*pPool, svl::Items<1, 1>); aChild2.SetParent(&aParent2); - SfxStringItem aItem2(1, "Item2"); + SfxStringItem aItem2(1, u"Item2"_ustr); aChild2.Put(aItem2); // Insert item sets in alphabetical order. StylePool aStylePool; - OUString aChild1Name("Child1"); + OUString aChild1Name(u"Child1"_ustr); aStylePool.insertItemSet(aChild1, &aChild1Name); - OUString aChild3Name("Child3"); + OUString aChild3Name(u"Child3"_ustr); aStylePool.insertItemSet(aChild3, &aChild3Name); - OUString aChild2Name("Child2"); + OUString aChild2Name(u"Child2"_ustr); aStylePool.insertItemSet(aChild2, &aChild2Name); std::unique_ptr<IStylePoolIteratorAccess> pIter = aStylePool.createIterator(); std::shared_ptr<SfxItemSet> pStyle1 = pIter->getNext(); CPPUNIT_ASSERT(pStyle1); const SfxStringItem* pItem1 = static_cast<const SfxStringItem*>(pStyle1->GetItem(1)); - CPPUNIT_ASSERT_EQUAL(OUString("Item1"), pItem1->GetValue()); + CPPUNIT_ASSERT_EQUAL(u"Item1"_ustr, pItem1->GetValue()); std::shared_ptr<SfxItemSet> pStyle2 = pIter->getNext(); CPPUNIT_ASSERT(pStyle2); const SfxStringItem* pItem2 = static_cast<const SfxStringItem*>(pStyle2->GetItem(1)); // Without the accompanying fix in place, this test would have failed with 'Expected: Item2; // Actual: Item3'. The iteration order depended on the pointer address on the pointer // address of the parents. - CPPUNIT_ASSERT_EQUAL(OUString("Item2"), pItem2->GetValue()); + CPPUNIT_ASSERT_EQUAL(u"Item2"_ustr, pItem2->GetValue()); std::shared_ptr<SfxItemSet> pStyle3 = pIter->getNext(); CPPUNIT_ASSERT(pStyle3); const SfxStringItem* pItem3 = static_cast<const SfxStringItem*>(pStyle3->GetItem(1)); - CPPUNIT_ASSERT_EQUAL(OUString("Item3"), pItem3->GetValue()); + CPPUNIT_ASSERT_EQUAL(u"Item3"_ustr, pItem3->GetValue()); CPPUNIT_ASSERT(!pIter->getNext()); } } CPPUNIT_TEST_FIXTURE(StylePoolTest, testFixedItemSet) { - rtl::Reference<SfxItemPool> pPool = new SfxItemPool("test"); + rtl::Reference<SfxItemPool> pPool = new SfxItemPool(u"test"_ustr); pPool->registerItemInfoPackage(getItemInfoPackageTest()); SfxItemSetFixed<1, 2> aItemSet1(*pPool); diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index 314ce263ecd7..37e741709558 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -76,8 +76,8 @@ void IndexedStyleSheetsTest::InstantiationWorks() void IndexedStyleSheetsTest::AddedStylesheetsCanBeFoundAndRetrievedByPosition() { - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("name1")); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("name2")); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(u"name1"_ustr)); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(u"name2"_ustr)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); iss.AddStyleSheet(sheet2); @@ -88,7 +88,7 @@ void IndexedStyleSheetsTest::AddedStylesheetsCanBeFoundAndRetrievedByPosition() void IndexedStyleSheetsTest::AddingSameStylesheetTwiceHasNoEffect() { - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("sheet1")); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(u"sheet1"_ustr)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), iss.GetNumberOfStyleSheets()); @@ -98,8 +98,8 @@ void IndexedStyleSheetsTest::AddingSameStylesheetTwiceHasNoEffect() void IndexedStyleSheetsTest::RemovedStyleSheetIsNotFound() { - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("name1")); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("name2")); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(u"name1"_ustr)); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(u"name2"_ustr)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); iss.AddStyleSheet(sheet2); @@ -110,8 +110,8 @@ void IndexedStyleSheetsTest::RemovedStyleSheetIsNotFound() void IndexedStyleSheetsTest::RemovingStyleSheetWhichIsNotAvailableHasNoEffect() { - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("sheet1")); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("sheet2")); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(u"sheet1"_ustr)); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(u"sheet2"_ustr)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), iss.GetNumberOfStyleSheets()); @@ -121,8 +121,8 @@ void IndexedStyleSheetsTest::RemovingStyleSheetWhichIsNotAvailableHasNoEffect() void IndexedStyleSheetsTest::StyleSheetsCanBeRetrievedByTheirName() { - OUString name1("name1"); - OUString name2("name2"); + OUString name1(u"name1"_ustr); + OUString name2(u"name2"_ustr); rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1)); rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name2)); rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name1)); @@ -149,7 +149,7 @@ void IndexedStyleSheetsTest::KnowsThatItStoresAStyleSheet() static constexpr OUString name1(u"name1"_ustr); rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name1)); rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name1)); - rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet("name2")); + rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(u"name2"_ustr)); rtl::Reference<SfxStyleSheetBase> sheet4(new MockedStyleSheet(name1)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); @@ -167,9 +167,9 @@ void IndexedStyleSheetsTest::KnowsThatItStoresAStyleSheet() void IndexedStyleSheetsTest::PositionCanBeQueriedByFamily() { - rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet("name1", SfxStyleFamily::Char)); - rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet("name2", SfxStyleFamily::Para)); - rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet("name3", SfxStyleFamily::Char)); + rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(u"name1"_ustr, SfxStyleFamily::Char)); + rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(u"name2"_ustr, SfxStyleFamily::Para)); + rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(u"name3"_ustr, SfxStyleFamily::Char)); IndexedStyleSheets iss; iss.AddStyleSheet(sheet1); @@ -185,7 +185,7 @@ void IndexedStyleSheetsTest::PositionCanBeQueriedByFamily() void IndexedStyleSheetsTest::OnlyOneStyleSheetIsReturnedWhenReturnFirstIsUsed() { - OUString name("name1"); + OUString name(u"name1"_ustr); rtl::Reference<SfxStyleSheetBase> sheet1(new MockedStyleSheet(name, SfxStyleFamily::Char)); rtl::Reference<SfxStyleSheetBase> sheet2(new MockedStyleSheet(name, SfxStyleFamily::Para)); rtl::Reference<SfxStyleSheetBase> sheet3(new MockedStyleSheet(name, SfxStyleFamily::Char)); diff --git a/svl/qa/unit/lockfiles/test_lockfiles.cxx b/svl/qa/unit/lockfiles/test_lockfiles.cxx index d66c301be4e7..7a55c731b203 100644 --- a/svl/qa/unit/lockfiles/test_lockfiles.cxx +++ b/svl/qa/unit/lockfiles/test_lockfiles.cxx @@ -107,7 +107,7 @@ void LockfileTest::testLOLockFileURL() OUString aTestODT = generateTestURL(u"testLOLockFileURL.odt"); svt::DocumentLockFile aLockFile(aTestODT); - CPPUNIT_ASSERT_EQUAL(OUString(".~lock.testLOLockFileURL.odt%23"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u".~lock.testLOLockFileURL.odt%23"_ustr, GetLockFileName(aLockFile)); } void LockfileTest::testLOLockFileContent() @@ -117,8 +117,8 @@ void LockfileTest::testLOLockFileContent() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and check the content svt::DocumentLockFile aLockFile(aTestODT); @@ -166,8 +166,8 @@ void LockfileTest::testLOLockFileRT() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and read it back svt::DocumentLockFile aLockFile(aTestODT); @@ -222,16 +222,16 @@ void LockfileTest::testLOLockFileOverwrite() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and read it back svt::DocumentLockFile aLockFile(aTestODT); aLockFile.CreateOwnLockFile(); // Change user name - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile2"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile2"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Overwrite lockfile svt::DocumentLockFile aLockFile2(aTestODT); @@ -261,56 +261,56 @@ void LockfileTest::testWordLockFileURL() { OUString aTestFile = generateTestURL(u"testWordLockFileURL.docx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$stWordLockFileURL.docx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$stWordLockFileURL.docx"_ustr, GetLockFileName(aLockFile)); } // Eight character file name (cuts two characters) { OUString aTestFile = generateTestURL(u"12345678.docx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$345678.docx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$345678.docx"_ustr, GetLockFileName(aLockFile)); } // Seven character file name (cuts one character) { OUString aTestFile = generateTestURL(u"1234567.docx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$234567.docx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$234567.docx"_ustr, GetLockFileName(aLockFile)); } // Six character file name (cuts no character) { OUString aTestFile = generateTestURL(u"123456.docx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$123456.docx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$123456.docx"_ustr, GetLockFileName(aLockFile)); } // One character file name { OUString aTestFile = generateTestURL(u"1.docx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$1.docx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$1.docx"_ustr, GetLockFileName(aLockFile)); } // Test for ODT format { OUString aTestFile = generateTestURL(u"12345678.odt"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$345678.odt"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$345678.odt"_ustr, GetLockFileName(aLockFile)); } // Test for DOC format { OUString aTestFile = generateTestURL(u"12345678.doc"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$345678.doc"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$345678.doc"_ustr, GetLockFileName(aLockFile)); } // Test for RTF format { OUString aTestFile = generateTestURL(u"12345678.rtf"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$345678.rtf"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$345678.rtf"_ustr, GetLockFileName(aLockFile)); } } @@ -320,28 +320,28 @@ void LockfileTest::testExcelLockFileURL() { OUString aTestFile = generateTestURL(u"testExcelLockFileURL.xlsx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$testExcelLockFileURL.xlsx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$testExcelLockFileURL.xlsx"_ustr, GetLockFileName(aLockFile)); } // Eight character file name { OUString aTestFile = generateTestURL(u"12345678.xlsx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$12345678.xlsx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$12345678.xlsx"_ustr, GetLockFileName(aLockFile)); } // One character file name { OUString aTestFile = generateTestURL(u"1.xlsx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$1.xlsx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$1.xlsx"_ustr, GetLockFileName(aLockFile)); } // Test for ODS format { OUString aTestFile = generateTestURL(u"12345678.ods"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$12345678.ods"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$12345678.ods"_ustr, GetLockFileName(aLockFile)); } } @@ -351,36 +351,35 @@ void LockfileTest::testPowerPointLockFileURL() { OUString aTestFile = generateTestURL(u"testPowerPointLockFileURL.pptx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$testPowerPointLockFileURL.pptx"), - GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$testPowerPointLockFileURL.pptx"_ustr, GetLockFileName(aLockFile)); } // Eight character file name { OUString aTestFile = generateTestURL(u"12345678.pptx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$12345678.pptx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$12345678.pptx"_ustr, GetLockFileName(aLockFile)); } // One character file name { OUString aTestFile = generateTestURL(u"1.pptx"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$1.pptx"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$1.pptx"_ustr, GetLockFileName(aLockFile)); } // Test for PPT format { OUString aTestFile = generateTestURL(u"12345678.ppt"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$12345678.ppt"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$12345678.ppt"_ustr, GetLockFileName(aLockFile)); } // Test for ODP format { OUString aTestFile = generateTestURL(u"/12345678.odp"); svt::MSODocumentLockFile aLockFile(aTestFile); - CPPUNIT_ASSERT_EQUAL(OUString("~$12345678.odp"), GetLockFileName(aLockFile)); + CPPUNIT_ASSERT_EQUAL(u"~$12345678.odp"_ustr, GetLockFileName(aLockFile)); } } @@ -391,8 +390,8 @@ void LockfileTest::testWordLockFileContent() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and check the content svt::MSODocumentLockFile aLockFile(aTestFile); @@ -443,8 +442,8 @@ void LockfileTest::testExcelLockFileContent() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and check the content svt::MSODocumentLockFile aLockFile(aTestFile); @@ -500,8 +499,8 @@ void LockfileTest::testPowerPointLockFileContent() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and check the content svt::MSODocumentLockFile aLockFile(aTestFile); @@ -558,8 +557,8 @@ void LockfileTest::testWordLockFileRT() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and read it back svt::MSODocumentLockFile aLockFile(aTestODT); @@ -579,8 +578,8 @@ void LockfileTest::testExcelLockFileRT() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and read it back svt::MSODocumentLockFile aLockFile(aTestODT); @@ -600,8 +599,8 @@ void LockfileTest::testPowerPointLockFileRT() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and read it back svt::MSODocumentLockFile aLockFile(aTestODT); @@ -622,9 +621,9 @@ void LockfileTest::testMSOLockFileLongUserName() // Set user name SvtUserOptions aUserOpt; aUserOpt.SetToken(UserOptToken::FirstName, - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + u"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"_ustr); aUserOpt.SetToken(UserOptToken::LastName, - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); + u"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"_ustr); // Write the lock file and read it back svt::MSODocumentLockFile aLockFile(aTestODT); @@ -673,16 +672,16 @@ void LockfileTest::testMSOLockFileOverwrite() // Set user name SvtUserOptions aUserOpt; - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Write the lock file and read it back svt::MSODocumentLockFile aLockFile(aTestODT); aLockFile.CreateOwnLockFile(); // Change user name - aUserOpt.SetToken(UserOptToken::FirstName, "LockFile2"); - aUserOpt.SetToken(UserOptToken::LastName, "Test"); + aUserOpt.SetToken(UserOptToken::FirstName, u"LockFile2"_ustr); + aUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr); // Overwrite lockfile svt::MSODocumentLockFile aLockFile2(aTestODT); diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 28ef860ba74d..389195ec1728 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -325,9 +325,9 @@ void Test::testNumberFormat() void Test::testSharedString() { // Use shared string as normal, non-shared string, which is allowed. - SharedString aSS1("Test"), aSS2("Test"); + SharedString aSS1(u"Test"_ustr), aSS2(u"Test"_ustr); CPPUNIT_ASSERT_MESSAGE("Equality check should return true.", bool(aSS1 == aSS2)); - SharedString aSS3("test"); + SharedString aSS3(u"test"_ustr); CPPUNIT_ASSERT_MESSAGE("Equality check is case sensitive.", aSS1 != aSS3); } @@ -337,15 +337,15 @@ void Test::testSharedStringPool() svl::SharedStringPool aPool(aSysLocale.GetCharClass()); svl::SharedString p1, p2; - p1 = aPool.intern("Andy"); - p2 = aPool.intern("Andy"); + p1 = aPool.intern(u"Andy"_ustr); + p2 = aPool.intern(u"Andy"_ustr); CPPUNIT_ASSERT_EQUAL(p1.getData(), p2.getData()); - p2 = aPool.intern("Bruce"); + p2 = aPool.intern(u"Bruce"_ustr); CPPUNIT_ASSERT_MESSAGE("They must differ.", p1.getData() != p2.getData()); - OUString aAndy("Andy"); - p1 = aPool.intern("Andy"); + OUString aAndy(u"Andy"_ustr); + p1 = aPool.intern(u"Andy"_ustr); p2 = aPool.intern(aAndy); CPPUNIT_ASSERT_MESSAGE("Identifier shouldn't be NULL.", p1.getData()); CPPUNIT_ASSERT_MESSAGE("Identifier shouldn't be NULL.", p2.getData()); @@ -353,12 +353,12 @@ void Test::testSharedStringPool() // Test case insensitive string ID's. p1 = aPool.intern(aAndy); - p2 = aPool.intern("andy"); + p2 = aPool.intern(u"andy"_ustr); CPPUNIT_ASSERT_MESSAGE("Failed to intern strings.", p1.getData()); CPPUNIT_ASSERT_MESSAGE("Failed to intern strings.", p2.getData()); CPPUNIT_ASSERT_MESSAGE("These two ID's should differ.", p1.getData() != p2.getData()); CPPUNIT_ASSERT_EQUAL_MESSAGE("These two ID's should be equal.", p2.getDataIgnoreCase(), p1.getDataIgnoreCase()); - p2 = aPool.intern("ANDY"); + p2 = aPool.intern(u"ANDY"_ustr); CPPUNIT_ASSERT_MESSAGE("Failed to intern string.", p2.getData()); CPPUNIT_ASSERT_MESSAGE("These two ID's should differ.", p1.getData() != p2.getData()); CPPUNIT_ASSERT_EQUAL_MESSAGE("These two ID's should be equal.", p2.getDataIgnoreCase(), p1.getDataIgnoreCase()); @@ -443,8 +443,8 @@ void Test::testSharedStringPoolEmptyString() // Make sure SharedString::getEmptyString() is in the pool and matches empty strings. SvtSysLocale aSysLocale; svl::SharedStringPool aPool(aSysLocale.GetCharClass()); - aPool.intern(""); - CPPUNIT_ASSERT_EQUAL(SharedString::getEmptyString(), aPool.intern("")); + aPool.intern(u""_ustr); + CPPUNIT_ASSERT_EQUAL(SharedString::getEmptyString(), aPool.intern(u""_ustr)); CPPUNIT_ASSERT_EQUAL(SharedString::getEmptyString(), aPool.intern(SharedString::EMPTY_STRING)); // And it should still work even after purging. aPool.purge(); @@ -1836,58 +1836,58 @@ void Test::testNfEnglishKeywordsIntegrity() CPPUNIT_ASSERT_EQUAL( sKeywords[i], rEnglishKeywords[i] ); } // Check the order of sEnglishKeyword - CPPUNIT_ASSERT_EQUAL( OUString("E"), rEnglishKeywords[NF_KEY_E] ); - CPPUNIT_ASSERT_EQUAL( OUString("AM/PM"), rEnglishKeywords[NF_KEY_AMPM] ); - CPPUNIT_ASSERT_EQUAL( OUString("A/P"), rEnglishKeywords[NF_KEY_AP] ); - CPPUNIT_ASSERT_EQUAL( OUString("M"), rEnglishKeywords[NF_KEY_MI] ); - CPPUNIT_ASSERT_EQUAL( OUString("MM"), rEnglishKeywords[NF_KEY_MMI] ); - CPPUNIT_ASSERT_EQUAL( OUString("M"), rEnglishKeywords[NF_KEY_M] ); - CPPUNIT_ASSERT_EQUAL( OUString("MM"), rEnglishKeywords[NF_KEY_MM] ); - CPPUNIT_ASSERT_EQUAL( OUString("MMM"), rEnglishKeywords[NF_KEY_MMM] ); - CPPUNIT_ASSERT_EQUAL( OUString("MMMM"), rEnglishKeywords[NF_KEY_MMMM] ); - CPPUNIT_ASSERT_EQUAL( OUString("H"), rEnglishKeywords[NF_KEY_H] ); - CPPUNIT_ASSERT_EQUAL( OUString("HH"), rEnglishKeywords[NF_KEY_HH] ); - CPPUNIT_ASSERT_EQUAL( OUString("S"), rEnglishKeywords[NF_KEY_S] ); - CPPUNIT_ASSERT_EQUAL( OUString("SS"), rEnglishKeywords[NF_KEY_SS] ); - CPPUNIT_ASSERT_EQUAL( OUString("Q"), rEnglishKeywords[NF_KEY_Q] ); - CPPUNIT_ASSERT_EQUAL( OUString("QQ"), rEnglishKeywords[NF_KEY_QQ] ); - CPPUNIT_ASSERT_EQUAL( OUString("D"), rEnglishKeywords[NF_KEY_D] ); - CPPUNIT_ASSERT_EQUAL( OUString("DD"), rEnglishKeywords[NF_KEY_DD] ); - CPPUNIT_ASSERT_EQUAL( OUString("DDD"), rEnglishKeywords[NF_KEY_DDD] ); - CPPUNIT_ASSERT_EQUAL( OUString("DDDD"), rEnglishKeywords[NF_KEY_DDDD] ); - CPPUNIT_ASSERT_EQUAL( OUString("YY"), rEnglishKeywords[NF_KEY_YY] ); - CPPUNIT_ASSERT_EQUAL( OUString("YYYY"), rEnglishKeywords[NF_KEY_YYYY] ); - CPPUNIT_ASSERT_EQUAL( OUString("NN"), rEnglishKeywords[NF_KEY_NN] ); - CPPUNIT_ASSERT_EQUAL( OUString("NNNN"), rEnglishKeywords[NF_KEY_NNNN] ); - CPPUNIT_ASSERT_EQUAL( OUString("CCC"), rEnglishKeywords[NF_KEY_CCC] ); - CPPUNIT_ASSERT_EQUAL( OUString("GENERAL"), rEnglishKeywords[NF_KEY_GENERAL] ); - CPPUNIT_ASSERT_EQUAL( OUString("NNN"), rEnglishKeywords[NF_KEY_NNN] ); - CPPUNIT_ASSERT_EQUAL( OUString("WW"), rEnglishKeywords[NF_KEY_WW] ); - CPPUNIT_ASSERT_EQUAL( OUString("MMMMM"), rEnglishKeywords[NF_KEY_MMMMM] ); - CPPUNIT_ASSERT_EQUAL( OUString("TRUE"), rEnglishKeywords[NF_KEY_TRUE] ); - CPPUNIT_ASSERT_EQUAL( OUString("FALSE"), rEnglishKeywords[NF_KEY_FALSE] ); - CPPUNIT_ASSERT_EQUAL( OUString("BOOLEAN"), rEnglishKeywords[NF_KEY_BOOLEAN] ); - CPPUNIT_ASSERT_EQUAL( OUString("COLOR"), rEnglishKeywords[NF_KEY_COLOR] ); - CPPUNIT_ASSERT_EQUAL( OUString("BLACK"), rEnglishKeywords[NF_KEY_BLACK] ); - CPPUNIT_ASSERT_EQUAL( OUString("BLUE"), rEnglishKeywords[NF_KEY_BLUE] ); - CPPUNIT_ASSERT_EQUAL( OUString("GREEN"), rEnglishKeywords[NF_KEY_GREEN] ); - CPPUNIT_ASSERT_EQUAL( OUString("CYAN"), rEnglishKeywords[NF_KEY_CYAN] ); - CPPUNIT_ASSERT_EQUAL( OUString("RED"), rEnglishKeywords[NF_KEY_RED] ); - CPPUNIT_ASSERT_EQUAL( OUString("MAGENTA"), rEnglishKeywords[NF_KEY_MAGENTA] ); - CPPUNIT_ASSERT_EQUAL( OUString("BROWN"), rEnglishKeywords[NF_KEY_BROWN] ); - CPPUNIT_ASSERT_EQUAL( OUString("GREY"), rEnglishKeywords[NF_KEY_GREY] ); - CPPUNIT_ASSERT_EQUAL( OUString("YELLOW"), rEnglishKeywords[NF_KEY_YELLOW] ); - CPPUNIT_ASSERT_EQUAL( OUString("WHITE"), rEnglishKeywords[NF_KEY_WHITE] ); - CPPUNIT_ASSERT_EQUAL( OUString("AAA"), rEnglishKeywords[NF_KEY_AAA]); - CPPUNIT_ASSERT_EQUAL( OUString("AAAA"), rEnglishKeywords[NF_KEY_AAAA] ); - CPPUNIT_ASSERT_EQUAL( OUString("E"), rEnglishKeywords[NF_KEY_EC] ); - CPPUNIT_ASSERT_EQUAL( OUString("EE"), rEnglishKeywords[NF_KEY_EEC] ); - CPPUNIT_ASSERT_EQUAL( OUString("G"), rEnglishKeywords[NF_KEY_G] ); - CPPUNIT_ASSERT_EQUAL( OUString("GG"), rEnglishKeywords[NF_KEY_GG] ); - CPPUNIT_ASSERT_EQUAL( OUString("GGG"), rEnglishKeywords[NF_KEY_GGG] ); - CPPUNIT_ASSERT_EQUAL( OUString("R"), rEnglishKeywords[NF_KEY_R] ); - CPPUNIT_ASSERT_EQUAL( OUString("RR"), rEnglishKeywords[NF_KEY_RR] ); - CPPUNIT_ASSERT_EQUAL( OUString("t"), rEnglishKeywords[NF_KEY_THAI_T] ); + CPPUNIT_ASSERT_EQUAL( u"E"_ustr, rEnglishKeywords[NF_KEY_E] ); + CPPUNIT_ASSERT_EQUAL( u"AM/PM"_ustr, rEnglishKeywords[NF_KEY_AMPM] ); + CPPUNIT_ASSERT_EQUAL( u"A/P"_ustr, rEnglishKeywords[NF_KEY_AP] ); + CPPUNIT_ASSERT_EQUAL( u"M"_ustr, rEnglishKeywords[NF_KEY_MI] ); + CPPUNIT_ASSERT_EQUAL( u"MM"_ustr, rEnglishKeywords[NF_KEY_MMI] ); + CPPUNIT_ASSERT_EQUAL( u"M"_ustr, rEnglishKeywords[NF_KEY_M] ); + CPPUNIT_ASSERT_EQUAL( u"MM"_ustr, rEnglishKeywords[NF_KEY_MM] ); + CPPUNIT_ASSERT_EQUAL( u"MMM"_ustr, rEnglishKeywords[NF_KEY_MMM] ); + CPPUNIT_ASSERT_EQUAL( u"MMMM"_ustr, rEnglishKeywords[NF_KEY_MMMM] ); + CPPUNIT_ASSERT_EQUAL( u"H"_ustr, rEnglishKeywords[NF_KEY_H] ); + CPPUNIT_ASSERT_EQUAL( u"HH"_ustr, rEnglishKeywords[NF_KEY_HH] ); + CPPUNIT_ASSERT_EQUAL( u"S"_ustr, rEnglishKeywords[NF_KEY_S] ); + CPPUNIT_ASSERT_EQUAL( u"SS"_ustr, rEnglishKeywords[NF_KEY_SS] ); + CPPUNIT_ASSERT_EQUAL( u"Q"_ustr, rEnglishKeywords[NF_KEY_Q] ); + CPPUNIT_ASSERT_EQUAL( u"QQ"_ustr, rEnglishKeywords[NF_KEY_QQ] ); + CPPUNIT_ASSERT_EQUAL( u"D"_ustr, rEnglishKeywords[NF_KEY_D] ); + CPPUNIT_ASSERT_EQUAL( u"DD"_ustr, rEnglishKeywords[NF_KEY_DD] ); + CPPUNIT_ASSERT_EQUAL( u"DDD"_ustr, rEnglishKeywords[NF_KEY_DDD] ); + CPPUNIT_ASSERT_EQUAL( u"DDDD"_ustr, rEnglishKeywords[NF_KEY_DDDD] ); + CPPUNIT_ASSERT_EQUAL( u"YY"_ustr, rEnglishKeywords[NF_KEY_YY] ); + CPPUNIT_ASSERT_EQUAL( u"YYYY"_ustr, rEnglishKeywords[NF_KEY_YYYY] ); + CPPUNIT_ASSERT_EQUAL( u"NN"_ustr, rEnglishKeywords[NF_KEY_NN] ); + CPPUNIT_ASSERT_EQUAL( u"NNNN"_ustr, rEnglishKeywords[NF_KEY_NNNN] ); + CPPUNIT_ASSERT_EQUAL( u"CCC"_ustr, rEnglishKeywords[NF_KEY_CCC] ); + CPPUNIT_ASSERT_EQUAL( u"GENERAL"_ustr, rEnglishKeywords[NF_KEY_GENERAL] ); + CPPUNIT_ASSERT_EQUAL( u"NNN"_ustr, rEnglishKeywords[NF_KEY_NNN] ); + CPPUNIT_ASSERT_EQUAL( u"WW"_ustr, rEnglishKeywords[NF_KEY_WW] ); + CPPUNIT_ASSERT_EQUAL( u"MMMMM"_ustr, rEnglishKeywords[NF_KEY_MMMMM] ); + CPPUNIT_ASSERT_EQUAL( u"TRUE"_ustr, rEnglishKeywords[NF_KEY_TRUE] ); + CPPUNIT_ASSERT_EQUAL( u"FALSE"_ustr, rEnglishKeywords[NF_KEY_FALSE] ); + CPPUNIT_ASSERT_EQUAL( u"BOOLEAN"_ustr, rEnglishKeywords[NF_KEY_BOOLEAN] ); + CPPUNIT_ASSERT_EQUAL( u"COLOR"_ustr, rEnglishKeywords[NF_KEY_COLOR] ); + CPPUNIT_ASSERT_EQUAL( u"BLACK"_ustr, rEnglishKeywords[NF_KEY_BLACK] ); + CPPUNIT_ASSERT_EQUAL( u"BLUE"_ustr, rEnglishKeywords[NF_KEY_BLUE] ); + CPPUNIT_ASSERT_EQUAL( u"GREEN"_ustr, rEnglishKeywords[NF_KEY_GREEN] ); + CPPUNIT_ASSERT_EQUAL( u"CYAN"_ustr, rEnglishKeywords[NF_KEY_CYAN] ); + CPPUNIT_ASSERT_EQUAL( u"RED"_ustr, rEnglishKeywords[NF_KEY_RED] ); + CPPUNIT_ASSERT_EQUAL( u"MAGENTA"_ustr, rEnglishKeywords[NF_KEY_MAGENTA] ); + CPPUNIT_ASSERT_EQUAL( u"BROWN"_ustr, rEnglishKeywords[NF_KEY_BROWN] ); + CPPUNIT_ASSERT_EQUAL( u"GREY"_ustr, rEnglishKeywords[NF_KEY_GREY] ); + CPPUNIT_ASSERT_EQUAL( u"YELLOW"_ustr, rEnglishKeywords[NF_KEY_YELLOW] ); + CPPUNIT_ASSERT_EQUAL( u"WHITE"_ustr, rEnglishKeywords[NF_KEY_WHITE] ); + CPPUNIT_ASSERT_EQUAL( u"AAA"_ustr, rEnglishKeywords[NF_KEY_AAA]); + CPPUNIT_ASSERT_EQUAL( u"AAAA"_ustr, rEnglishKeywords[NF_KEY_AAAA] ); + CPPUNIT_ASSERT_EQUAL( u"E"_ustr, rEnglishKeywords[NF_KEY_EC] ); + CPPUNIT_ASSERT_EQUAL( u"EE"_ustr, rEnglishKeywords[NF_KEY_EEC] ); + CPPUNIT_ASSERT_EQUAL( u"G"_ustr, rEnglishKeywords[NF_KEY_G] ); + CPPUNIT_ASSERT_EQUAL( u"GG"_ustr, rEnglishKeywords[NF_KEY_GG] ); + CPPUNIT_ASSERT_EQUAL( u"GGG"_ustr, rEnglishKeywords[NF_KEY_GGG] ); + CPPUNIT_ASSERT_EQUAL( u"R"_ustr, rEnglishKeywords[NF_KEY_R] ); + CPPUNIT_ASSERT_EQUAL( u"RR"_ustr, rEnglishKeywords[NF_KEY_RR] ); + CPPUNIT_ASSERT_EQUAL( u"t"_ustr, rEnglishKeywords[NF_KEY_THAI_T] ); } void Test::testStandardColorIntegrity() @@ -1923,8 +1923,8 @@ void Test::testColorNamesConversion() aGermanKeywords[i] = rKeywords[i]; // Check that we actually have German and English keywords. - CPPUNIT_ASSERT_EQUAL( OUString("FARBE"), aGermanKeywords[NF_KEY_COLOR]); - CPPUNIT_ASSERT_EQUAL( OUString("COLOR"), rEnglishKeywords[NF_KEY_COLOR]); + CPPUNIT_ASSERT_EQUAL( u"FARBE"_ustr, aGermanKeywords[NF_KEY_COLOR]); + CPPUNIT_ASSERT_EQUAL( u"COLOR"_ustr, rEnglishKeywords[NF_KEY_COLOR]); // Test each color conversion. // [FARBE1] -> [COLOR1] can't be tested because we have no color table link @@ -1976,11 +1976,11 @@ void Test::testExcelExportFormats() aCode = aFormatter.GetFormatStringForExcel( nKey1, aKeywords, aTempFormatter); // Test that LCID is prepended. - CPPUNIT_ASSERT_EQUAL( OUString("[$-1C09]00.00"), aCode); + CPPUNIT_ASSERT_EQUAL( u"[$-1C09]00.00"_ustr, aCode); aCode = aFormatter.GetFormatStringForExcel( nKey2, aKeywords, aTempFormatter); // Test that LCID is not prepended. Note that literal characters are escaped. - CPPUNIT_ASSERT_EQUAL( OUString("[$R-1C09]\\ #,##0.0;[$R-1C09]\\-#,##0.0"), aCode); + CPPUNIT_ASSERT_EQUAL( u"[$R-1C09]\\ #,##0.0;[$R-1C09]\\-#,##0.0"_ustr, aCode); } CPPUNIT_TEST_FIXTURE(Test, testLanguageNone) @@ -1988,12 +1988,12 @@ CPPUNIT_TEST_FIXTURE(Test, testLanguageNone) SvNumberFormatter aFormatter(m_xContext, LANGUAGE_ENGLISH_US); NfKeywordTable keywords; aFormatter.FillKeywordTableForExcel(keywords); - OUString code("TT.MM.JJJJ"); + OUString code(u"TT.MM.JJJJ"_ustr); sal_uInt32 nKey = aFormatter.GetEntryKey(code, LANGUAGE_GERMAN); CPPUNIT_ASSERT(nKey != NUMBERFORMAT_ENTRY_NOT_FOUND); SvNumberformat const*const pFormat = aFormatter.GetEntry(nKey); LocaleDataWrapper ldw(m_xContext, LanguageTag(pFormat->GetLanguage())); - CPPUNIT_ASSERT_EQUAL(OUString("dd.mm.yyyy"), pFormat->GetMappedFormatstring(keywords, ldw)); + CPPUNIT_ASSERT_EQUAL(u"dd.mm.yyyy"_ustr, pFormat->GetMappedFormatstring(keywords, ldw)); } CPPUNIT_TEST_FIXTURE(Test, testTdf160306) diff --git a/svl/qa/unit/test_INetContentType.cxx b/svl/qa/unit/test_INetContentType.cxx index 288cfe919008..f305b8c839b9 100644 --- a/svl/qa/unit/test_INetContentType.cxx +++ b/svl/qa/unit/test_INetContentType.cxx @@ -37,7 +37,7 @@ public: }; void Test::testBad() { - OUString in("foo=bar"); + OUString in(u"foo=bar"_ustr); CPPUNIT_ASSERT_EQUAL( static_cast<void const *>(nullptr), static_cast<void const *>(INetMIME::scanContentType(in))); @@ -51,7 +51,7 @@ void Test::testBad() { } void Test::testFull() { - OUString in("foo/bar;baz=boz"); + OUString in(u"foo/bar;baz=boz"_ustr); CPPUNIT_ASSERT_EQUAL( static_cast<void const *>(in.getStr() + in.getLength()), static_cast<void const *>(INetMIME::scanContentType(in))); @@ -59,15 +59,15 @@ void Test::testFull() { OUString s; INetContentTypeParameterList ps; CPPUNIT_ASSERT(INetContentTypes::parse(in, t, s, &ps)); - CPPUNIT_ASSERT_EQUAL(OUString("foo"), t); - CPPUNIT_ASSERT_EQUAL(OUString("bar"), s); + CPPUNIT_ASSERT_EQUAL(u"foo"_ustr, t); + CPPUNIT_ASSERT_EQUAL(u"bar"_ustr, s); auto iter = ps.find("baz"_ostr); CPPUNIT_ASSERT(iter != ps.end()); - CPPUNIT_ASSERT_EQUAL(OUString("boz"), iter->second.m_sValue); + CPPUNIT_ASSERT_EQUAL(u"boz"_ustr, iter->second.m_sValue); } void Test::testFollow() { - OUString in("foo/bar;baz=boz;base64,"); + OUString in(u"foo/bar;baz=boz;base64,"_ustr); CPPUNIT_ASSERT_EQUAL( static_cast<void const *>(in.getStr() + std::strlen("foo/bar;baz=boz")), static_cast<void const *>(INetMIME::scanContentType(in))); diff --git a/svl/qa/unit/test_SvAddressParser.cxx b/svl/qa/unit/test_SvAddressParser.cxx index b015f9a1b389..ac368d450078 100644 --- a/svl/qa/unit/test_SvAddressParser.cxx +++ b/svl/qa/unit/test_SvAddressParser.cxx @@ -27,40 +27,40 @@ class Test : public CppUnit::TestFixture // <https://tools.ietf.org/html/rfc822> "Standard for the Format of ARPA Internet Text // Messages": { - SvAddressParser p("Alfred Neuman <Neuman@BBN-TENEXA>"); + SvAddressParser p(u"Alfred Neuman <Neuman@BBN-TENEXA>"_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), p.Count()); - CPPUNIT_ASSERT_EQUAL(OUString("Neuman@BBN-TENEXA"), p.GetEmailAddress(0)); + CPPUNIT_ASSERT_EQUAL(u"Neuman@BBN-TENEXA"_ustr, p.GetEmailAddress(0)); } { - SvAddressParser p("Neuman@BBN-TENEXA"); + SvAddressParser p(u"Neuman@BBN-TENEXA"_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), p.Count()); - CPPUNIT_ASSERT_EQUAL(OUString("Neuman@BBN-TENEXA"), p.GetEmailAddress(0)); + CPPUNIT_ASSERT_EQUAL(u"Neuman@BBN-TENEXA"_ustr, p.GetEmailAddress(0)); } { - SvAddressParser p("\"George, Ted\" <Shared@Group.Arpanet>"); + SvAddressParser p(u"\"George, Ted\" <Shared@Group.Arpanet>"_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), p.Count()); - CPPUNIT_ASSERT_EQUAL(OUString("Shared@Group.Arpanet"), p.GetEmailAddress(0)); + CPPUNIT_ASSERT_EQUAL(u"Shared@Group.Arpanet"_ustr, p.GetEmailAddress(0)); } { - SvAddressParser p("Wilt . (the Stilt) Chamberlain@NBA.US"); + SvAddressParser p(u"Wilt . (the Stilt) Chamberlain@NBA.US"_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), p.Count()); - CPPUNIT_ASSERT_EQUAL(OUString("Wilt.Chamberlain@NBA.US"), p.GetEmailAddress(0)); + CPPUNIT_ASSERT_EQUAL(u"Wilt.Chamberlain@NBA.US"_ustr, p.GetEmailAddress(0)); } { - SvAddressParser p("Gourmets: Pompous Person <WhoZiWhatZit@Cordon-Bleu>,\n" + SvAddressParser p(u"Gourmets: Pompous Person <WhoZiWhatZit@Cordon-Bleu>,\n" " Childs@WGBH.Boston, Galloping Gourmet@\n" " ANT.Down-Under (Australian National Television),\n" " Cheapie@Discount-Liquors;,\n" " Cruisers: Port@Portugal, Jones@SEA;,\n" - " Another@Somewhere.SomeOrg"); + " Another@Somewhere.SomeOrg"_ustr); CPPUNIT_ASSERT_EQUAL(sal_Int32(7), p.Count()); - CPPUNIT_ASSERT_EQUAL(OUString("WhoZiWhatZit@Cordon-Bleu"), p.GetEmailAddress(0)); - CPPUNIT_ASSERT_EQUAL(OUString("Childs@WGBH.Boston"), p.GetEmailAddress(1)); - CPPUNIT_ASSERT_EQUAL(OUString("Gourmet@ANT.Down-Under"), p.GetEmailAddress(2)); - CPPUNIT_ASSERT_EQUAL(OUString("Cheapie@Discount-Liquors"), p.GetEmailAddress(3)); - CPPUNIT_ASSERT_EQUAL(OUString("Port@Portugal"), p.GetEmailAddress(4)); - CPPUNIT_ASSERT_EQUAL(OUString("Jones@SEA"), p.GetEmailAddress(5)); - CPPUNIT_ASSERT_EQUAL(OUString("Another@Somewhere.SomeOrg"), p.GetEmailAddress(6)); + CPPUNIT_ASSERT_EQUAL(u"WhoZiWhatZit@Cordon-Bleu"_ustr, p.GetEmailAddress(0)); + CPPUNIT_ASSERT_EQUAL(u"Childs@WGBH.Boston"_ustr, p.GetEmailAddress(1)); + CPPUNIT_ASSERT_EQUAL(u"Gourmet@ANT.Down-Under"_ustr, p.GetEmailAddress(2)); + CPPUNIT_ASSERT_EQUAL(u"Cheapie@Discount-Liquors"_ustr, p.GetEmailAddress(3)); + CPPUNIT_ASSERT_EQUAL(u"Port@Portugal"_ustr, p.GetEmailAddress(4)); + CPPUNIT_ASSERT_EQUAL(u"Jones@SEA"_ustr, p.GetEmailAddress(5)); + CPPUNIT_ASSERT_EQUAL(u"Another@Somewhere.SomeOrg"_ustr, p.GetEmailAddress(6)); } } diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx index 516f4eb4fd04..ea1f12d5855a 100644 --- a/svl/qa/unit/test_URIHelper.cxx +++ b/svl/qa/unit/test_URIHelper.cxx @@ -214,13 +214,13 @@ void Test::finish() { void Test::testNormalizedMakeRelative() { auto ucb(css::ucb::UniversalContentBroker::create(m_context)); - ucb->registerContentProvider(new Provider, "test", true); + ucb->registerContentProvider(new Provider, u"test"_ustr, true); ucb->registerContentProvider( css::uno::Reference<css::ucb::XContentProvider>( m_context->getServiceManager()->createInstanceWithContext( - "com.sun.star.comp.ucb.FileProvider", m_context), + u"com.sun.star.comp.ucb.FileProvider"_ustr, m_context), css::uno::UNO_QUERY_THROW), - "file", true); + u"file"_ustr, true); struct Data { char const * base; char const * absolute; @@ -369,7 +369,7 @@ void Test::testFindFirstURLInText() { { "generic:path", nullptr, 0, 0 }, { "wfs:", nullptr, 0, 0 } }; - CharClass charClass( m_context, LanguageTag( css::lang::Locale("en", "US", ""))); + CharClass charClass( m_context, LanguageTag( css::lang::Locale(u"en"_ustr, u"US"_ustr, u""_ustr))); for (auto const[pInput, pResult, nBegin, nEnd] : tests) { OUString input(OUString::createFromAscii(pInput)); @@ -420,7 +420,7 @@ void Test::testFindFirstDOIInText() { { "doi:10.1093", nullptr, 0, 0 }, // no slash { "doi:11.1093/ajae/aaq063", nullptr, 0, 0 }, // doesn't begin with doi:10. }; - CharClass charClass( m_context, LanguageTag( css::lang::Locale("en", "US", ""))); + CharClass charClass( m_context, LanguageTag( css::lang::Locale(u"en"_ustr, u"US"_ustr, u""_ustr))); for (auto const[pInput, pResult, nBegin, nEnd] : tests) { OUString input(OUString::createFromAscii(pInput)); @@ -492,28 +492,28 @@ void Test::testResolveIdnaHost() { URIHelper::resolveIdnaHost(u"foo://M\u00FCnchen@M\u00FCnchen.de"_ustr)); CPPUNIT_ASSERT_EQUAL( - OUString("foo://xn--mnchen-3ya.de."), + u"foo://xn--mnchen-3ya.de."_ustr, URIHelper::resolveIdnaHost(u"foo://M\u00FCnchen.de."_ustr)); CPPUNIT_ASSERT_EQUAL( - OUString("Foo://bar@xn--mnchen-3ya.de:123/?bar#baz"), + u"Foo://bar@xn--mnchen-3ya.de:123/?bar#baz"_ustr, URIHelper::resolveIdnaHost(u"Foo://bar@M\u00FCnchen.de:123/?bar#baz"_ustr)); CPPUNIT_ASSERT_EQUAL( - OUString("foo://xn--mnchen-3ya.de"), + u"foo://xn--mnchen-3ya.de"_ustr, URIHelper::resolveIdnaHost(u"foo://Mu\u0308nchen.de"_ustr)); CPPUNIT_ASSERT_EQUAL( - OUString("foo://example.xn--m-eha"), URIHelper::resolveIdnaHost(u"foo://example.mü"_ustr)); + u"foo://example.xn--m-eha"_ustr, URIHelper::resolveIdnaHost(u"foo://example.mü"_ustr)); CPPUNIT_ASSERT_EQUAL( - OUString("foo://example.xn--m-eha:0"), URIHelper::resolveIdnaHost(u"foo://example.mü:0"_ustr)); + u"foo://example.xn--m-eha:0"_ustr, URIHelper::resolveIdnaHost(u"foo://example.mü:0"_ustr)); CPPUNIT_ASSERT_EQUAL( - OUString("foo://xn--e1afmkfd.xn--p1ai"), URIHelper::resolveIdnaHost(u"foo://пример.рф"_ustr)); + u"foo://xn--e1afmkfd.xn--p1ai"_ustr, URIHelper::resolveIdnaHost(u"foo://пример.рф"_ustr)); CPPUNIT_ASSERT_EQUAL( - OUString("foo://xn--e1afmkfd.xn--p1ai:0"), + u"foo://xn--e1afmkfd.xn--p1ai:0"_ustr, URIHelper::resolveIdnaHost(u"foo://пример.рф:0"_ustr)); } diff --git a/svl/qa/unit/test_lngmisc.cxx b/svl/qa/unit/test_lngmisc.cxx index 2e82deac6339..7330db00b5ef 100644 --- a/svl/qa/unit/test_lngmisc.cxx +++ b/svl/qa/unit/test_lngmisc.cxx @@ -42,13 +42,13 @@ private: void LngMiscTest::testRemoveHyphens() { - OUString str1(""); - OUString str2("a-b--c---"); + OUString str1(u""_ustr); + OUString str2(u"a-b--c---"_ustr); OUString str3 = OUStringChar(SVT_SOFT_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN) + OUStringChar(SVT_HARD_HYPHEN); - OUString str4("asdf"); + OUString str4(u"asdf"_ustr); bool bModified = linguistic::RemoveHyphens(str1); CPPUNIT_ASSERT(!bModified); @@ -57,7 +57,7 @@ void LngMiscTest::testRemoveHyphens() // Note that '-' isn't a hyphen to RemoveHyphens. bModified = linguistic::RemoveHyphens(str2); CPPUNIT_ASSERT(!bModified); - CPPUNIT_ASSERT_EQUAL(OUString("a-b--c---"), str2); + CPPUNIT_ASSERT_EQUAL(u"a-b--c---"_ustr, str2); bModified = linguistic::RemoveHyphens(str3); CPPUNIT_ASSERT(bModified); @@ -65,14 +65,14 @@ void LngMiscTest::testRemoveHyphens() bModified = linguistic::RemoveHyphens(str4); CPPUNIT_ASSERT(!bModified); - CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str4); + CPPUNIT_ASSERT_EQUAL(u"asdf"_ustr, str4); } void LngMiscTest::testRemoveControlChars() { - OUString str1(""); - OUString str2("asdf"); - OUString str3("asdf\nasdf"); + OUString str1(u""_ustr); + OUString str2(u"asdf"_ustr); + OUString str3(u"asdf\nasdf"_ustr); OUStringBuffer str4Buf(33); str4Buf.setLength(33); @@ -88,22 +88,22 @@ void LngMiscTest::testRemoveControlChars() bModified = linguistic::RemoveControlChars(str2); CPPUNIT_ASSERT(!bModified); - CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str2); + CPPUNIT_ASSERT_EQUAL(u"asdf"_ustr, str2); bModified = linguistic::RemoveControlChars(str3); CPPUNIT_ASSERT(bModified); - CPPUNIT_ASSERT_EQUAL(OUString("asdfasdf"), str3); + CPPUNIT_ASSERT_EQUAL(u"asdfasdf"_ustr, str3); bModified = linguistic::RemoveControlChars(str4); CPPUNIT_ASSERT(bModified); - CPPUNIT_ASSERT_EQUAL(OUString(" "), str4); + CPPUNIT_ASSERT_EQUAL(u" "_ustr, str4); } void LngMiscTest::testReplaceControlChars() { - OUString str1(""); - OUString str2("asdf"); - OUString str3("asdf\nasdf"); + OUString str1(u""_ustr); + OUString str2(u"asdf"_ustr); + OUString str3(u"asdf\nasdf"_ustr); OUStringBuffer str4Buf(33); str4Buf.setLength(33); @@ -119,11 +119,11 @@ void LngMiscTest::testReplaceControlChars() bModified = linguistic::ReplaceControlChars(str2); CPPUNIT_ASSERT(!bModified); - CPPUNIT_ASSERT_EQUAL(OUString("asdf"), str2); + CPPUNIT_ASSERT_EQUAL(u"asdf"_ustr, str2); bModified = linguistic::ReplaceControlChars(str3); CPPUNIT_ASSERT(bModified); - CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), str3); + CPPUNIT_ASSERT_EQUAL(u"asdf asdf"_ustr, str3); bModified = linguistic::ReplaceControlChars(str4); CPPUNIT_ASSERT(bModified); @@ -136,28 +136,28 @@ void LngMiscTest::testGetThesaurusReplaceText() { constexpr OUString str2(u"asdf"_ustr); - OUString r = linguistic::GetThesaurusReplaceText(""); + OUString r = linguistic::GetThesaurusReplaceText(u""_ustr); CPPUNIT_ASSERT(r.isEmpty()); r = linguistic::GetThesaurusReplaceText(str2); CPPUNIT_ASSERT_EQUAL(str2, r); - r = linguistic::GetThesaurusReplaceText("asdf (abc)"); + r = linguistic::GetThesaurusReplaceText(u"asdf (abc)"_ustr); CPPUNIT_ASSERT_EQUAL(str2, r); - r = linguistic::GetThesaurusReplaceText("asdf*"); + r = linguistic::GetThesaurusReplaceText(u"asdf*"_ustr); CPPUNIT_ASSERT_EQUAL(str2, r); - r = linguistic::GetThesaurusReplaceText("asdf * "); + r = linguistic::GetThesaurusReplaceText(u"asdf * "_ustr); CPPUNIT_ASSERT_EQUAL(str2, r); - r = linguistic::GetThesaurusReplaceText("asdf (abc) *"); + r = linguistic::GetThesaurusReplaceText(u"asdf (abc) *"_ustr); CPPUNIT_ASSERT_EQUAL(str2, r); - r = linguistic::GetThesaurusReplaceText("asdf asdf * (abc)"); - CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), r); + r = linguistic::GetThesaurusReplaceText(u"asdf asdf * (abc)"_ustr); + CPPUNIT_ASSERT_EQUAL(u"asdf asdf"_ustr, r); - r = linguistic::GetThesaurusReplaceText(" * (abc) asdf *"); + r = linguistic::GetThesaurusReplaceText(u" * (abc) asdf *"_ustr); CPPUNIT_ASSERT(r.isEmpty()); } |