diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-10 13:18:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-10 18:42:35 +0200 |
commit | ca5c9591ba38ad83415a2d4ced98bfc74d30b032 (patch) | |
tree | dcccbec3d99727cffe7debd21d3c40521383857b /sfx2/qa/cppunit/doc.cxx | |
parent | e888503ee0aecbce8f3075b106243cf68b8dddc7 (diff) |
loplugin:ostr in sfx2
Change-Id: I6306260d03c1208ec250c2f9a3860fa569f6d9c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167448
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/qa/cppunit/doc.cxx')
-rw-r--r-- | sfx2/qa/cppunit/doc.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sfx2/qa/cppunit/doc.cxx b/sfx2/qa/cppunit/doc.cxx index 9eea6d29390d..555c5f5aea78 100644 --- a/sfx2/qa/cppunit/doc.cxx +++ b/sfx2/qa/cppunit/doc.cxx @@ -31,7 +31,7 @@ class Test : public UnoApiTest { public: Test() - : UnoApiTest("/sfx2/qa/cppunit/data/") + : UnoApiTest(u"/sfx2/qa/cppunit/data/"_ustr) { } }; @@ -39,9 +39,9 @@ public: CPPUNIT_TEST_FIXTURE(Test, testNoGrabBagShape) { // Load a document and select the first shape. - css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue("ReadOnly", - true) }; - mxComponent = loadFromDesktop("private:factory/simpress", "", aArgs); + css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue( + u"ReadOnly"_ustr, true) }; + mxComponent = loadFromDesktop(u"private:factory/simpress"_ustr, u""_ustr, aArgs); uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(xModel, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xDrawPage( @@ -65,7 +65,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNoGrabBagShape) CPPUNIT_TEST_FIXTURE(Test, testTempFilePath) { // Create a test file in a directory that contains the URL-encoded "testÿ" string. - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); auto pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); CPPUNIT_ASSERT(pBaseModel); OUString aTargetDir @@ -73,7 +73,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTempFilePath) osl::Directory::create(aTargetDir); OUString aTargetFile = aTargetDir + "/test.odt"; css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue( - "FilterName", OUString("writer8")) }; + u"FilterName"_ustr, u"writer8"_ustr) }; pBaseModel->storeAsURL(aTargetFile, aArgs); mxComponent->dispose(); @@ -82,7 +82,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTempFilePath) pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); OUString aPdfTarget = aTargetDir + "/test.pdf"; css::uno::Sequence<css::beans::PropertyValue> aPdfArgs{ comphelper::makePropertyValue( - "FilterName", OUString("writer_pdf_Export")) }; + u"FilterName"_ustr, u"writer_pdf_Export"_ustr) }; // Without the accompanying fix in place, this test would have failed on Windows with: // An uncaught exception of type com.sun.star.io.IOException // because we first tried to create a temp file next to test.odt in a directory named @@ -93,16 +93,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTempFilePath) CPPUNIT_TEST_FIXTURE(Test, testSetDocumentPropertiesUpdate) { // Given a document with 3 custom props, 2 Zotero ones and one other: - mxComponent = loadFromDesktop("private:factory/swriter"); + mxComponent = loadFromDesktop(u"private:factory/swriter"_ustr); auto pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); CPPUNIT_ASSERT(pBaseModel); uno::Reference<document::XDocumentProperties> xDP = pBaseModel->getDocumentProperties(); uno::Reference<beans::XPropertyContainer> xUDP = xDP->getUserDefinedProperties(); - xUDP->addProperty("ZOTERO_PREF_1", beans::PropertyAttribute::REMOVABLE, - uno::Any(OUString("foo"))); - xUDP->addProperty("ZOTERO_PREF_2", beans::PropertyAttribute::REMOVABLE, - uno::Any(OUString("bar"))); - xUDP->addProperty("OTHER", beans::PropertyAttribute::REMOVABLE, uno::Any(OUString("baz"))); + xUDP->addProperty(u"ZOTERO_PREF_1"_ustr, beans::PropertyAttribute::REMOVABLE, + uno::Any(u"foo"_ustr)); + xUDP->addProperty(u"ZOTERO_PREF_2"_ustr, beans::PropertyAttribute::REMOVABLE, + uno::Any(u"bar"_ustr)); + xUDP->addProperty(u"OTHER"_ustr, beans::PropertyAttribute::REMOVABLE, uno::Any(u"baz"_ustr)); // When updating the Zotero ones (1 update, 1 removal): std::vector<beans::PropertyValue> aArgsVec = comphelper::JsonToPropertyValues(R"json( @@ -128,21 +128,21 @@ CPPUNIT_TEST_FIXTURE(Test, testSetDocumentPropertiesUpdate) } )json"_ostr); uno::Sequence<beans::PropertyValue> aArgs = comphelper::containerToSequence(aArgsVec); - dispatchCommand(mxComponent, ".uno:SetDocumentProperties", aArgs); + dispatchCommand(mxComponent, u".uno:SetDocumentProperties"_ustr, aArgs); // Then make sure that OTHER is still there and that ZOTERO_PREF_1 + ZOTERO_PREF_2 gets updated // to the new value of a single ZOTERO_PREF_1: uno::Reference<beans::XPropertyAccess> xUDPAccess(xUDP, uno::UNO_QUERY); comphelper::SequenceAsHashMap aMap(xUDPAccess->getPropertyValues()); - auto it = aMap.find("ZOTERO_PREF_1"); + auto it = aMap.find(u"ZOTERO_PREF_1"_ustr); CPPUNIT_ASSERT(it != aMap.end()); // Without the accompanying fix in place, this test would have failed with: // - Expected: test // - Actual : foo // i.e. ZOTERO_PREF_1 was not updated. - CPPUNIT_ASSERT_EQUAL(OUString("test"), it->second.get<OUString>()); - CPPUNIT_ASSERT(bool(aMap.find("ZOTERO_PREF_2") == aMap.end())); - CPPUNIT_ASSERT(aMap.find("OTHER") != aMap.end()); + CPPUNIT_ASSERT_EQUAL(u"test"_ustr, it->second.get<OUString>()); + CPPUNIT_ASSERT(bool(aMap.find(u"ZOTERO_PREF_2"_ustr) == aMap.end())); + CPPUNIT_ASSERT(aMap.find(u"OTHER"_ustr) != aMap.end()); } } |