include/vcl/ITiledRenderable.hxx | 2 vcl/inc/jsdialog/jsdialogbuilder.hxx | 6 vcl/jsdialog/jsdialogbuilder.cxx | 39 vcl/qa/cppunit/GraphicFormatDetectorTest.cxx | 45 vcl/qa/cppunit/PDFDocumentTest.cxx | 129 - vcl/qa/cppunit/PDFiumLibraryTest.cxx | 2 vcl/qa/cppunit/TypeSerializerTest.cxx | 2 vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 4 vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx | 8 vcl/qa/cppunit/pdfexport/pdfexport.cxx | 689 +++---- vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 1376 +++++++-------- vcl/qa/cppunit/svm/svmtest.cxx | 328 +-- vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx | 22 vcl/source/filter/GraphicFormatDetector.cxx | 14 vcl/source/filter/graphicfilter.cxx | 2 vcl/source/filter/idxf/dxfentrd.cxx | 10 vcl/source/filter/ieps/ieps.cxx | 2 vcl/source/filter/ipdf/pdfdocument.cxx | 88 vcl/source/gdi/WidgetDefinition.cxx | 2 vcl/source/gdi/WidgetDefinitionReader.cxx | 68 vcl/source/gdi/gdimetafiletools.cxx | 4 vcl/source/gdi/gdimtf.cxx | 4 vcl/source/gdi/mtfxmldump.cxx | 116 - vcl/source/gdi/pdfobjectcopier.cxx | 12 vcl/source/gdi/pdfwriter_impl.cxx | 52 vcl/source/gdi/pdfwriter_impl2.cxx | 4 vcl/source/outdev/gradient.cxx | 4 vcl/source/outdev/transparent.cxx | 4 vcl/source/pdf/XmpMetadata.cxx | 81 vcl/source/treelist/iconview.cxx | 2 vcl/source/treelist/imap2.cxx | 4 vcl/source/window/DocWindow.cxx | 2 vcl/source/window/floatwin.cxx | 2 vcl/unx/generic/app/sm.cxx | 8 vcl/unx/generic/fontmanager/helper.cxx | 2 vcl/unx/generic/printer/cpdmgr.cxx | 26 vcl/unx/generic/printer/printerinfomanager.cxx | 34 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx | 2 vcl/workben/svpclient.cxx | 4 39 files changed, 1649 insertions(+), 1556 deletions(-)
New commits: commit 56c89190a2c717d6c24f2826f3b82ffe41b0ab6e Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 19 13:22:44 2023 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 19 15:23:35 2023 +0100 Extended loplugin:ostr: vcl Change-Id: I2a9d5383d1831d8bf61e5280d66556d71fccae52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159666 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 9b76eb11200e..be6c050ad36d 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -223,7 +223,7 @@ public: virtual OString getSheetGeometryData(bool /*bColumns*/, bool /*bRows*/, bool /*bSizes*/, bool /*bHidden*/, bool /*bFiltered*/, bool /*bGroups*/) { - return ""; + return ""_ostr; } /** diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 030638e06e75..6e611c4f962c 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -396,7 +396,7 @@ public: { std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "show"; + (*pMap)[ACTION_TYPE ""_ostr] = "show"; sendAction(std::move(pMap)); } } @@ -409,7 +409,7 @@ public: { std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "hide"; + (*pMap)[ACTION_TYPE ""_ostr] = "hide"; sendAction(std::move(pMap)); } } @@ -448,7 +448,7 @@ public: { BaseInstanceClass::grab_focus(); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "grab_focus"; + (*pMap)[ACTION_TYPE ""_ostr] = "grab_focus"; sendAction(std::move(pMap)); } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index f694a5778fe7..def963b0510e 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -300,12 +300,13 @@ void JSDialogNotifyIdle::Invoke() break; case jsdialog::MessageType::Popup: - send(*generatePopupMessage(rMessage.m_pWindow, (*rMessage.m_pData)[PARENT_ID], - (*rMessage.m_pData)[CLOSE_ID])); + send(*generatePopupMessage(rMessage.m_pWindow, + (*rMessage.m_pData)[PARENT_ID ""_ostr], + (*rMessage.m_pData)[CLOSE_ID ""_ostr])); break; case jsdialog::MessageType::PopupClose: - send(*generateClosePopupMessage((*rMessage.m_pData)[WINDOW_ID])); + send(*generateClosePopupMessage((*rMessage.m_pData)[WINDOW_ID ""_ostr])); break; } } @@ -371,8 +372,8 @@ void JSDialogSender::sendPopup(VclPtr<vcl::Window> pWindow, OUString sParentId, return; std::unique_ptr<jsdialog::ActionDataMap> pData = std::make_unique<jsdialog::ActionDataMap>(); - (*pData)[PARENT_ID] = sParentId; - (*pData)[CLOSE_ID] = sCloseId; + (*pData)[PARENT_ID ""_ostr] = sParentId; + (*pData)[CLOSE_ID ""_ostr] = sCloseId; mpIdleNotify->sendMessage(jsdialog::MessageType::Popup, pWindow, std::move(pData)); mpIdleNotify->Start(); } @@ -383,7 +384,7 @@ void JSDialogSender::sendClosePopup(vcl::LOKWindowId nWindowId) return; std::unique_ptr<jsdialog::ActionDataMap> pData = std::make_unique<jsdialog::ActionDataMap>(); - (*pData)[WINDOW_ID] = OUString::number(nWindowId); + (*pData)[WINDOW_ID ""_ostr] = OUString::number(nWindowId); mpIdleNotify->sendMessage(jsdialog::MessageType::PopupClose, nullptr, std::move(pData)); flush(); } @@ -1655,8 +1656,8 @@ void JSComboBox::set_entry_text(const OUString& rText) SalInstanceComboBoxWithEdit::set_entry_text(rText); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "setText"; - (*pMap)["text"] = rText; + (*pMap)[ACTION_TYPE ""_ostr] = "setText"; + (*pMap)["text"_ostr] = rText; sendAction(std::move(pMap)); } @@ -1668,8 +1669,8 @@ void JSComboBox::set_active(int pos) SalInstanceComboBoxWithEdit::set_active(pos); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "select"; - (*pMap)["position"] = OUString::number(pos); + (*pMap)[ACTION_TYPE ""_ostr] = "select"; + (*pMap)["position"_ostr] = OUString::number(pos); sendAction(std::move(pMap)); } @@ -1703,9 +1704,9 @@ void JSComboBox::render_entry(int pos, int dpix, int dpiy) ::comphelper::Base64::encode(aBuffer, aSeq); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "rendered_combobox_entry"; - (*pMap)["pos"] = OUString::number(pos); - (*pMap)["image"] = aBuffer; + (*pMap)[ACTION_TYPE ""_ostr] = "rendered_combobox_entry"; + (*pMap)["pos"_ostr] = OUString::number(pos); + (*pMap)["image"_ostr] = aBuffer; sendAction(std::move(pMap)); } } @@ -1758,8 +1759,8 @@ void JSSpinButton::set_value(sal_Int64 value) SalInstanceSpinButton::set_value(value); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "setText"; - (*pMap)["text"] = OUString::number(m_rFormatter.GetValue()); + (*pMap)[ACTION_TYPE ""_ostr] = "setText"; + (*pMap)["text"_ostr] = OUString::number(m_rFormatter.GetValue()); sendAction(std::move(pMap)); } @@ -2059,8 +2060,8 @@ void JSTreeView::select(int pos) enable_notify_events(); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "select"; - (*pMap)["position"] = OUString::number(pos); + (*pMap)[ACTION_TYPE ""_ostr] = "select"; + (*pMap)["position"_ostr] = OUString::number(pos); sendAction(std::move(pMap)); } @@ -2224,8 +2225,8 @@ void JSIconView::select(int pos) SalInstanceIconView::select(pos); std::unique_ptr<jsdialog::ActionDataMap> pMap = std::make_unique<jsdialog::ActionDataMap>(); - (*pMap)[ACTION_TYPE] = "select"; - (*pMap)["position"] = OUString::number(pos); + (*pMap)[ACTION_TYPE ""_ostr] = "select"; + (*pMap)["position"_ostr] = OUString::number(pos); sendAction(std::move(pMap)); } diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx index 945cb6d1c613..13c612e46e05 100644 --- a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx +++ b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx @@ -410,30 +410,30 @@ void GraphicFormatDetectorTest::testMatchArray() int nCheckSize = aString.size(); // Check beginning of the input string - pMatchPointer = vcl::matchArrayWithString(pCompleteStringPointer, nCheckSize, "<?xml"); + pMatchPointer = vcl::matchArrayWithString(pCompleteStringPointer, nCheckSize, "<?xml"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(0, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "<?xml")); // Check middle of the input string - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "version"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "version"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(6, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "version")); - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "<svg"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "<svg"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(38, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "<svg")); // Check end of the input string - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "/svg>"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "/svg>"_ostr); CPPUNIT_ASSERT(pMatchPointer != nullptr); CPPUNIT_ASSERT_EQUAL(119, int(pMatchPointer - pCompleteStringPointer)); CPPUNIT_ASSERT_EQUAL(true, o3tl::starts_with(pMatchPointer, "/svg>")); // Check that non-existing search string - pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "none"); + pMatchPointer = vcl::matchArrayWithString(aString.c_str(), nCheckSize, "none"_ostr); CPPUNIT_ASSERT(pMatchPointer == nullptr); } @@ -448,54 +448,61 @@ void GraphicFormatDetectorTest::testCheckArrayForMatchingStrings() bool bResult; // check beginning string - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "<?xml" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "<?xml"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check ending string - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "/svg>" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check middle string - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "version" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "version"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check beginning and then ending string bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "/svg>" }); + { "<?xml"_ostr, "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check ending and then beginning string bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "/svg>", "<?xml" }); + { "/svg>"_ostr, "<?xml"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check middle strings bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "version", "<svg" }); + { "version"_ostr, "<svg"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check beginning, middle and ending strings - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "version", "<svg", "/svg>" }); + bResult = vcl::checkArrayForMatchingStrings( + pCompleteStringPointer, nCheckSize, + { "<?xml"_ostr, "version"_ostr, "<svg"_ostr, "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(true, bResult); // check non-existing - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "none" }); + bResult + = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, { "none"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check non-existing on the beginning - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "none", "version", "<svg", "/svg>" }); + bResult = vcl::checkArrayForMatchingStrings( + pCompleteStringPointer, nCheckSize, + { "none"_ostr, "version"_ostr, "<svg"_ostr, "/svg>"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check non-existing on the end - bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "version", "<svg", "none" }); + bResult = vcl::checkArrayForMatchingStrings( + pCompleteStringPointer, nCheckSize, + { "<?xml"_ostr, "version"_ostr, "<svg"_ostr, "none"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); // check non-existing after the end bResult = vcl::checkArrayForMatchingStrings(pCompleteStringPointer, nCheckSize, - { "<?xml", "/svg>", "none" }); + { "<?xml"_ostr, "/svg>"_ostr, "none"_ostr }); CPPUNIT_ASSERT_EQUAL(false, bResult); } diff --git a/vcl/qa/cppunit/PDFDocumentTest.cxx b/vcl/qa/cppunit/PDFDocumentTest.cxx index 88fcdc0a765b..1223eebcbd18 100644 --- a/vcl/qa/cppunit/PDFDocumentTest.cxx +++ b/vcl/qa/cppunit/PDFDocumentTest.cxx @@ -34,25 +34,25 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseBasicPDF) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(size_t(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); - vcl::filter::PDFObjectElement* pTest = pResources->LookupObject("Test"); + vcl::filter::PDFObjectElement* pTest = pResources->LookupObject("Test"_ostr); CPPUNIT_ASSERT(pTest); - vcl::filter::PDFObjectElement* pTestArray1 = pTest->LookupObject("TestArray1"); + vcl::filter::PDFObjectElement* pTestArray1 = pTest->LookupObject("TestArray1"_ostr); CPPUNIT_ASSERT(pTestArray1); { CPPUNIT_ASSERT_EQUAL(size_t(5), pTestArray1->GetArray()->GetElements().size()); } - vcl::filter::PDFObjectElement* pTestArray2 = pTest->LookupObject("TestArray2"); + vcl::filter::PDFObjectElement* pTestArray2 = pTest->LookupObject("TestArray2"_ostr); CPPUNIT_ASSERT(pTestArray2); { CPPUNIT_ASSERT_EQUAL(size_t(2), pTestArray2->GetArray()->GetElements().size()); } - vcl::filter::PDFObjectElement* pTestDictionary = pTest->LookupObject("TestDictionary"); + vcl::filter::PDFObjectElement* pTestDictionary = pTest->LookupObject("TestDictionary"_ostr); { sal_uInt64 nOffset = pTestDictionary->GetDictionaryOffset(); sal_uInt64 nLength = pTestDictionary->GetDictionaryLength(); @@ -63,8 +63,8 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseBasicPDF) OString aString(aBuffer.data()); CPPUNIT_ASSERT_EQUAL( - OString("/TestReference 7 0 R/TestNumber " - "123/TestName/SomeName/TestDictionary<</Key/Value>>/TestArray[1 2 3]"), + "/TestReference 7 0 R/TestNumber " + "123/TestName/SomeName/TestDictionary<</Key/Value>>/TestArray[1 2 3]"_ostr, aString); } @@ -73,85 +73,90 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseBasicPDF) auto const& rItems = pTestDictionary->GetDictionaryItems(); CPPUNIT_ASSERT_EQUAL(size_t(5), rItems.size()); auto* pReference = dynamic_cast<vcl::filter::PDFReferenceElement*>( - pTestDictionary->Lookup("TestReference")); + pTestDictionary->Lookup("TestReference"_ostr)); CPPUNIT_ASSERT(pReference); CPPUNIT_ASSERT_EQUAL(7, pReference->GetObjectValue()); - auto* pNumber - = dynamic_cast<vcl::filter::PDFNumberElement*>(pTestDictionary->Lookup("TestNumber")); + auto* pNumber = dynamic_cast<vcl::filter::PDFNumberElement*>( + pTestDictionary->Lookup("TestNumber"_ostr)); CPPUNIT_ASSERT(pNumber); CPPUNIT_ASSERT_EQUAL(123.0, pNumber->GetValue()); auto* pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pTestDictionary->Lookup("TestName")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pTestDictionary->Lookup("TestName"_ostr)); CPPUNIT_ASSERT(pName); - CPPUNIT_ASSERT_EQUAL(OString("SomeName"), pName->GetValue()); + CPPUNIT_ASSERT_EQUAL("SomeName"_ostr, pName->GetValue()); auto* pDictionary = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pTestDictionary->Lookup("TestDictionary")); + pTestDictionary->Lookup("TestDictionary"_ostr)); CPPUNIT_ASSERT(pDictionary); - auto* pArray - = dynamic_cast<vcl::filter::PDFArrayElement*>(pTestDictionary->Lookup("TestArray")); + auto* pArray = dynamic_cast<vcl::filter::PDFArrayElement*>( + pTestDictionary->Lookup("TestArray"_ostr)); CPPUNIT_ASSERT(pArray); // Check offsets and lengths { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestReference"); + sal_uInt64 nOffset + = pTestDictionary->GetDictionary()->GetKeyOffset("TestReference"_ostr); sal_uInt64 nLength - = pTestDictionary->GetDictionary()->GetKeyValueLength("TestReference"); + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestReference"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestReference 7 0 R"), aString); + CPPUNIT_ASSERT_EQUAL("TestReference 7 0 R"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestNumber"); - sal_uInt64 nLength = pTestDictionary->GetDictionary()->GetKeyValueLength("TestNumber"); + sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestNumber"_ostr); + sal_uInt64 nLength + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestNumber"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestNumber 123"), aString); + CPPUNIT_ASSERT_EQUAL("TestNumber 123"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestName"); - sal_uInt64 nLength = pTestDictionary->GetDictionary()->GetKeyValueLength("TestName"); + sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestName"_ostr); + sal_uInt64 nLength + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestName"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestName/SomeName"), aString); + CPPUNIT_ASSERT_EQUAL("TestName/SomeName"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestDictionary"); + sal_uInt64 nOffset + = pTestDictionary->GetDictionary()->GetKeyOffset("TestDictionary"_ostr); sal_uInt64 nLength - = pTestDictionary->GetDictionary()->GetKeyValueLength("TestDictionary"); + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestDictionary"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestDictionary<</Key/Value>>"), aString); + CPPUNIT_ASSERT_EQUAL("TestDictionary<</Key/Value>>"_ostr, aString); } { - sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestArray"); - sal_uInt64 nLength = pTestDictionary->GetDictionary()->GetKeyValueLength("TestArray"); + sal_uInt64 nOffset = pTestDictionary->GetDictionary()->GetKeyOffset("TestArray"_ostr); + sal_uInt64 nLength + = pTestDictionary->GetDictionary()->GetKeyValueLength("TestArray"_ostr); aStream.Seek(nOffset); std::vector<char> aBuffer(nLength + 1, 0); aStream.ReadBytes(aBuffer.data(), nLength); OString aString(aBuffer.data()); - CPPUNIT_ASSERT_EQUAL(OString("TestArray[1 2 3]"), aString); + CPPUNIT_ASSERT_EQUAL("TestArray[1 2 3]"_ostr, aString); } } } @@ -273,7 +278,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryWithName) { addObjectElement(aElements, aDocument, 1, 0); addDictionaryElement(aElements); - addNameElement(aElements, "Test"); + addNameElement(aElements, "Test"_ostr); addNumberElement(aElements, 30.0); addEndDictionaryElement(aElements); addEndObjectElement(aElements); @@ -288,7 +293,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryWithName) CPPUNIT_ASSERT(pObject->GetDictionary()); CPPUNIT_ASSERT_EQUAL(size_t(1), pObject->GetDictionary()->GetItems().size()); auto& rItems = pObject->GetDictionary()->GetItems(); - auto pNumberElement = dynamic_cast<vcl::filter::PDFNumberElement*>(rItems.at("Test")); + auto pNumberElement = dynamic_cast<vcl::filter::PDFNumberElement*>(rItems.at("Test"_ostr)); CPPUNIT_ASSERT(pNumberElement); CPPUNIT_ASSERT_DOUBLES_EQUAL(30.0, pNumberElement->GetValue(), 1e-4); } @@ -301,21 +306,21 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryNested) addObjectElement(aElements, aDocument, 1, 0); addDictionaryElement(aElements); - addNameElement(aElements, "Nested1"); + addNameElement(aElements, "Nested1"_ostr); addDictionaryElement(aElements); { - addNameElement(aElements, "Nested2"); + addNameElement(aElements, "Nested2"_ostr); addDictionaryElement(aElements); { - addNameElement(aElements, "SomeOtherKey"); - addNameElement(aElements, "SomeOtherValue"); + addNameElement(aElements, "SomeOtherKey"_ostr); + addNameElement(aElements, "SomeOtherValue"_ostr); } addEndDictionaryElement(aElements); } addEndDictionaryElement(aElements); - addNameElement(aElements, "SomeOtherKey"); - addNameElement(aElements, "SomeOtherValue"); + addNameElement(aElements, "SomeOtherKey"_ostr); + addNameElement(aElements, "SomeOtherValue"_ostr); addEndObjectElement(aElements); } @@ -328,8 +333,8 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseDictionaryNested) CPPUNIT_ASSERT(pObject->GetDictionary()); CPPUNIT_ASSERT_EQUAL(size_t(2), pObject->GetDictionary()->GetItems().size()); - CPPUNIT_ASSERT(pObject->Lookup("Nested1")); - CPPUNIT_ASSERT(pObject->Lookup("SomeOtherKey")); + CPPUNIT_ASSERT(pObject->Lookup("Nested1"_ostr)); + CPPUNIT_ASSERT(pObject->Lookup("SomeOtherKey"_ostr)); } CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseEmptyArray) @@ -361,7 +366,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayWithSimpleElements) { auto pObjectPtr = addObjectElement(aElements, aDocument, 1, 0); addArrayElement(aElements, pObjectPtr); - addNameElement(aElements, "Test"); + addNameElement(aElements, "Test"_ostr); addNumberElement(aElements, 30.0); addEndArrayElement(aElements); addEndObjectElement(aElements); @@ -434,23 +439,23 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pObjectPtr = addObjectElement(aElements, aDocument, 1, 0); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner1"); - addNameElement(aElements, "Inner2"); + addNameElement(aElements, "Inner1"_ostr); + addNameElement(aElements, "Inner2"_ostr); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner31"); + addNameElement(aElements, "Inner31"_ostr); } addEndArrayElement(aElements); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner41"); - addNameElement(aElements, "Inner42"); + addNameElement(aElements, "Inner41"_ostr); + addNameElement(aElements, "Inner42"_ostr); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner431"); - addNameElement(aElements, "Inner432"); + addNameElement(aElements, "Inner431"_ostr); + addNameElement(aElements, "Inner432"_ostr); } addEndArrayElement(aElements); } @@ -458,10 +463,10 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner51"); + addNameElement(aElements, "Inner51"_ostr); addArrayElement(aElements, pObjectPtr); { - addNameElement(aElements, "Inner521"); + addNameElement(aElements, "Inner521"_ostr); } addEndArrayElement(aElements); } @@ -485,11 +490,11 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pName1 = dynamic_cast<vcl::filter::PDFNameElement*>(pRootArray->GetElement(0)); CPPUNIT_ASSERT(pName1); - CPPUNIT_ASSERT_EQUAL(OString("Inner1"), pName1->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner1"_ostr, pName1->GetValue()); auto pName2 = dynamic_cast<vcl::filter::PDFNameElement*>(pRootArray->GetElement(1)); CPPUNIT_ASSERT(pName2); - CPPUNIT_ASSERT_EQUAL(OString("Inner2"), pName2->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner2"_ostr, pName2->GetValue()); auto pArray3 = dynamic_cast<vcl::filter::PDFArrayElement*>(pRootArray->GetElement(2)); CPPUNIT_ASSERT(pArray3); @@ -497,7 +502,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner31 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray3->GetElement(0)); CPPUNIT_ASSERT(pInner31); - CPPUNIT_ASSERT_EQUAL(OString("Inner31"), pInner31->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner31"_ostr, pInner31->GetValue()); auto pArray4 = dynamic_cast<vcl::filter::PDFArrayElement*>(pRootArray->GetElement(3)); CPPUNIT_ASSERT(pArray4); @@ -505,11 +510,11 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner41 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray4->GetElement(0)); CPPUNIT_ASSERT(pInner41); - CPPUNIT_ASSERT_EQUAL(OString("Inner41"), pInner41->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner41"_ostr, pInner41->GetValue()); auto pInner42 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray4->GetElement(1)); CPPUNIT_ASSERT(pInner42); - CPPUNIT_ASSERT_EQUAL(OString("Inner42"), pInner42->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner42"_ostr, pInner42->GetValue()); auto pArray43 = dynamic_cast<vcl::filter::PDFArrayElement*>(pArray4->GetElement(2)); CPPUNIT_ASSERT(pArray43); @@ -517,11 +522,11 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner431 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray43->GetElement(0)); CPPUNIT_ASSERT(pInner431); - CPPUNIT_ASSERT_EQUAL(OString("Inner431"), pInner431->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner431"_ostr, pInner431->GetValue()); auto pInner432 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray43->GetElement(1)); CPPUNIT_ASSERT(pInner432); - CPPUNIT_ASSERT_EQUAL(OString("Inner432"), pInner432->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner432"_ostr, pInner432->GetValue()); auto pArray5 = dynamic_cast<vcl::filter::PDFArrayElement*>(pRootArray->GetElement(4)); CPPUNIT_ASSERT(pArray5); @@ -529,7 +534,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner51 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray5->GetElement(0)); CPPUNIT_ASSERT(pInner51); - CPPUNIT_ASSERT_EQUAL(OString("Inner51"), pInner51->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner51"_ostr, pInner51->GetValue()); auto pArray52 = dynamic_cast<vcl::filter::PDFArrayElement*>(pArray5->GetElement(1)); CPPUNIT_ASSERT(pArray52); @@ -537,7 +542,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseArrayNestedWithNames) auto pInner521 = dynamic_cast<vcl::filter::PDFNameElement*>(pArray52->GetElement(0)); CPPUNIT_ASSERT(pInner521); - CPPUNIT_ASSERT_EQUAL(OString("Inner521"), pInner521->GetValue()); + CPPUNIT_ASSERT_EQUAL("Inner521"_ostr, pInner521->GetValue()); } } @@ -549,7 +554,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseTrailer) { addTrailerObjectElement(aElements, aDocument); addDictionaryElement(aElements); - addNameElement(aElements, "Size"); + addNameElement(aElements, "Size"_ostr); addNumberElement(aElements, 11.0); addEndDictionaryElement(aElements); } @@ -573,7 +578,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseTrailerWithReference) { addTrailerObjectElement(aElements, aDocument); addDictionaryElement(aElements); - addNameElement(aElements, "Reference"); + addNameElement(aElements, "Reference"_ostr); auto pNumberElement1 = addNumberElement(aElements, 11.0); auto pNumberElement2 = addNumberElement(aElements, 0.0); addReferenceElement(aElements, aDocument, pNumberElement1, pNumberElement2); @@ -588,7 +593,7 @@ CPPUNIT_TEST_FIXTURE(PDFDocumentTest, testParseTrailerWithReference) CPPUNIT_ASSERT(pTrailer->GetDictionary()); CPPUNIT_ASSERT_EQUAL(size_t(1), pTrailer->GetDictionary()->GetItems().size()); - auto pElement = pTrailer->Lookup("Reference"); + auto pElement = pTrailer->Lookup("Reference"_ostr); CPPUNIT_ASSERT(pElement); auto pReference = dynamic_cast<vcl::filter::PDFReferenceElement*>(pElement); CPPUNIT_ASSERT(pReference); diff --git a/vcl/qa/cppunit/PDFiumLibraryTest.cxx b/vcl/qa/cppunit/PDFiumLibraryTest.cxx index c933273bc147..966c44a3f568 100644 --- a/vcl/qa/cppunit/PDFiumLibraryTest.cxx +++ b/vcl/qa/cppunit/PDFiumLibraryTest.cxx @@ -396,7 +396,7 @@ void PDFiumLibraryTest::testAnnotationsDifferentTypes() CPPUNIT_ASSERT(pAnnotation); CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFAnnotationSubType::Polygon, pAnnotation->getSubType()); CPPUNIT_ASSERT_EQUAL(0, pAnnotation->getObjectCount()); - CPPUNIT_ASSERT_EQUAL(true, pAnnotation->hasKey("Vertices")); + CPPUNIT_ASSERT_EQUAL(true, pAnnotation->hasKey("Vertices"_ostr)); OUString aContentsString = pAnnotation->getString(vcl::pdf::constDictionaryKeyContents); CPPUNIT_ASSERT_EQUAL(OUString("Polygon Text"), aContentsString); auto const& aVertices = pAnnotation->getVertices(); diff --git a/vcl/qa/cppunit/TypeSerializerTest.cxx b/vcl/qa/cppunit/TypeSerializerTest.cxx index 726843e19a03..b27f1c3c822a 100644 --- a/vcl/qa/cppunit/TypeSerializerTest.cxx +++ b/vcl/qa/cppunit/TypeSerializerTest.cxx @@ -336,7 +336,7 @@ void TypeSerializerTest::testGraphic_GDIMetaFile() char aIdCharArray[7] = { 0, 0, 0, 0, 0, 0, 0 }; aMemoryStream.ReadBytes(aIdCharArray, 6); OString sID(aIdCharArray); - CPPUNIT_ASSERT_EQUAL(OString("VCLMTF"), sID); + CPPUNIT_ASSERT_EQUAL("VCLMTF"_ostr, sID); // Read it back aMemoryStream.Seek(STREAM_SEEK_TO_BEGIN); diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 7097c89970d3..dbe7ada758e7 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -145,7 +145,7 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testDictArrayDict) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT(!aPages.empty()); vcl::filter::PDFObjectElement* pPage = aPages[0]; - auto pKey = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Key")); + auto pKey = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Key"_ostr)); // Without the accompanying fix in place, this test would have failed, because the value of Key // was a dictionary element, not an array element. @@ -201,7 +201,7 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT(!aPages.empty()); vcl::filter::PDFObjectElement* pPage = aPages[0]; - auto pTest = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Test")); + auto pTest = dynamic_cast<vcl::filter::PDFArrayElement*>(pPage->Lookup("Test"_ostr)); std::vector<vcl::filter::PDFElement*> aElements = pTest->GetElements(); // Without the accompanying fix in place, this test would have failed with diff --git a/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx index a24f2d324d97..ebce81f9ab0c 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx @@ -81,10 +81,10 @@ void PictFilterTest::testDontClipTooMuch() CPPUNIT_ASSERT (pDoc); - assertXPath(pDoc, "/metafile/clipregion[5]", "top", "0"); - assertXPath(pDoc, "/metafile/clipregion[5]", "left", "0"); - assertXPath(pDoc, "/metafile/clipregion[5]", "bottom", "empty"); - assertXPath(pDoc, "/metafile/clipregion[5]", "right", "empty"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "top"_ostr, "0"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "left"_ostr, "0"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "bottom"_ostr, "empty"); + assertXPath(pDoc, "/metafile/clipregion[5]"_ostr, "right"_ostr, "empty"); } CPPUNIT_TEST_SUITE_REGISTRATION(PictFilterTest); diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index ef317e600ca5..020d5c4c49d1 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -90,10 +90,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); // The document has one page. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); // The page has one image. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); @@ -102,7 +102,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106059) CPPUNIT_ASSERT(pReferenceXObject); // The image is a reference XObject. // This dictionary key was missing, so the XObject wasn't a reference one. - CPPUNIT_ASSERT(pReferenceXObject->Lookup("Ref")); + CPPUNIT_ASSERT(pReferenceXObject->Lookup("Ref"_ostr)); } /// Tests export of PDF images without reference XObjects. @@ -115,10 +115,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106693) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); // The document has one page. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); // The page has one image. CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); @@ -126,29 +126,29 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106693) = pXObjects->LookupObject(pXObjects->GetItems().begin()->first); CPPUNIT_ASSERT(pXObject); // The image is a form XObject. - auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype")); + auto pSubtype = dynamic_cast<vcl::filter::PDFNameElement*>(pXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pSubtype); - CPPUNIT_ASSERT_EQUAL(OString("Form"), pSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pSubtype->GetValue()); // This failed: UseReferenceXObject was ignored and Ref was always created. - CPPUNIT_ASSERT(!pXObject->Lookup("Ref")); + CPPUNIT_ASSERT(!pXObject->Lookup("Ref"_ostr)); // Assert that the form object refers to an inner form object, not a // bitmap. auto pInnerResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pInnerResources); auto pInnerXObjects = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pInnerResources->LookupElement("XObject")); + pInnerResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pInnerXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pInnerXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pInnerXObject = pInnerXObjects->LookupObject(pInnerXObjects->GetItems().begin()->first); CPPUNIT_ASSERT(pInnerXObject); auto pInnerSubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pInnerXObject->Lookup("Subtype"_ostr)); CPPUNIT_ASSERT(pInnerSubtype); // This failed: this was Image (bitmap), not Form (vector). - CPPUNIT_ASSERT_EQUAL(OString("Form"), pInnerSubtype->GetValue()); + CPPUNIT_ASSERT_EQUAL("Form"_ostr, pInnerSubtype->GetValue()); } /// Tests that text highlight from Impress is not lost. @@ -239,7 +239,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105093) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page annotations. - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pAnnots->GetElements().size()); auto pAnnotReference @@ -248,23 +248,24 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105093) vcl::filter::PDFObjectElement* pAnnot = pAnnotReference->LookupObject(); CPPUNIT_ASSERT(pAnnot); CPPUNIT_ASSERT_EQUAL( - OString("Annot"), - static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"))->GetValue()); + "Annot"_ostr, + static_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr))->GetValue()); // Get the Action -> Rendition -> MediaClip -> FileSpec. - auto pAction = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A")); + auto pAction = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAnnot->Lookup("A"_ostr)); CPPUNIT_ASSERT(pAction); - auto pRendition = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAction->LookupElement("R")); + auto pRendition + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAction->LookupElement("R"_ostr)); CPPUNIT_ASSERT(pRendition); auto pMediaClip - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pRendition->LookupElement("C")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pRendition->LookupElement("C"_ostr)); CPPUNIT_ASSERT(pMediaClip); auto pFileSpec - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pMediaClip->LookupElement("D")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pMediaClip->LookupElement("D"_ostr)); CPPUNIT_ASSERT(pFileSpec); // Make sure the filespec refers to an embedded file. // This key was missing, the embedded video was handled as a linked one. - CPPUNIT_ASSERT(pFileSpec->LookupElement("EF")); + CPPUNIT_ASSERT(pFileSpec->LookupElement("EF"_ostr)); } /// Tests export of non-PDF images. @@ -279,7 +280,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106206) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // The page has a stream. - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -293,14 +294,14 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106206) CPPUNIT_ASSERT(aZCodec.EndCompression()); // Make sure there is an image reference there. - OString aImage("/Im"); + OString aImage("/Im"_ostr); auto pStart = static_cast<const char*>(aUncompressed.GetData()); const char* pEnd = pStart + aUncompressed.GetSize(); auto it = std::search(pStart, pEnd, aImage.getStr(), aImage.getStr() + aImage.getLength()); CPPUNIT_ASSERT(it != pEnd); // And also that it's not an invalid one. - OString aInvalidImage("/Im0"); + OString aInvalidImage("/Im0"_ostr); it = std::search(pStart, pEnd, aInvalidImage.getStr(), aInvalidImage.getStr() + aInvalidImage.getLength()); // This failed, object #0 was referenced. @@ -326,7 +327,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf127217) std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(0); // Without the fix in place, this test would have failed here - CPPUNIT_ASSERT(!pAnnot->hasKey("DA")); + CPPUNIT_ASSERT(!pAnnot->hasKey("DA"_ostr)); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf109143) @@ -340,10 +341,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf109143) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get access to the only image on the only page. - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -351,7 +352,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf109143) CPPUNIT_ASSERT(pXObject); // Make sure it's re-compressed. - auto pLength = dynamic_cast<vcl::filter::PDFNumberElement*>(pXObject->Lookup("Length")); + auto pLength = dynamic_cast<vcl::filter::PDFNumberElement*>(pXObject->Lookup("Length"_ostr)); CPPUNIT_ASSERT(pLength); int nLength = pLength->GetValue(); // This failed: cropped TIFF-in-JPEG wasn't re-compressed, so crop was @@ -368,10 +369,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972) // Get access to the only form object on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -380,10 +381,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972) // Get access to the only image inside the form object. auto pFormResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pFormResources); auto pImages = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pFormResources->LookupElement("XObject")); + pFormResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pImages); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pImages->GetItems().size()); vcl::filter::PDFObjectElement* pImage @@ -392,10 +393,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972) // Assert resources of the image. auto pImageResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pImage->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pImage->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pImageResources); // This failed: the PDF image had no Font resource. - CPPUNIT_ASSERT(pImageResources->LookupElement("Font")); + CPPUNIT_ASSERT(pImageResources->LookupElement("Font"_ostr)); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972Pdf17) @@ -407,10 +408,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972Pdf17) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -419,7 +420,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf106972Pdf17) // Assert that we now attempt to preserve the original PDF data, even if // the original input was PDF >= 1.4. - CPPUNIT_ASSERT(pXObject->Lookup("Resources")); + CPPUNIT_ASSERT(pXObject->Lookup("Resources"_ostr)); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testSofthyphenPos) @@ -477,10 +478,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107013) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -497,10 +498,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -509,10 +510,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) // Get access to the form object inside the image. auto pXObjectResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pXObjectResources); auto pXObjectForms = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pXObjectResources->LookupElement("XObject")); + pXObjectResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pXObjectForms); vcl::filter::PDFObjectElement* pForm = pXObjectForms->LookupObject(pXObjectForms->GetItems().begin()->first); @@ -520,28 +521,29 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107018) // Get access to Resources -> Font -> F1 of the form. auto pFormResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pForm->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pForm->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pFormResources); - auto pFonts - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pFormResources->LookupElement("Font")); + auto pFonts = dynamic_cast<vcl::filter::PDFDictionaryElement*>( + pFormResources->LookupElement("Font"_ostr)); CPPUNIT_ASSERT(pFonts); - auto pF1Ref = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFonts->LookupElement("F1")); + auto pF1Ref = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFonts->LookupElement("F1"_ostr)); CPPUNIT_ASSERT(pF1Ref); vcl::filter::PDFObjectElement* pF1 = pF1Ref->LookupObject(); CPPUNIT_ASSERT(pF1); // Check that Foo -> Bar of the font is of type Pages. - auto pFontFoo = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pF1->Lookup("Foo")); + auto pFontFoo = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pF1->Lookup("Foo"_ostr)); CPPUNIT_ASSERT(pFontFoo); - auto pBar = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFontFoo->LookupElement("Bar")); + auto pBar + = dynamic_cast<vcl::filter::PDFReferenceElement*>(pFontFoo->LookupElement("Bar"_ostr)); CPPUNIT_ASSERT(pBar); vcl::filter::PDFObjectElement* pObject = pBar->LookupObject(); CPPUNIT_ASSERT(pObject); - auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pName = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); CPPUNIT_ASSERT(pName); // This was "XObject", reference in a nested dictionary wasn't updated when // copying the page stream of a PDF image. - CPPUNIT_ASSERT_EQUAL(OString("Pages"), pName->GetValue()); + CPPUNIT_ASSERT_EQUAL("Pages"_ostr, pName->GetValue()); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706) @@ -562,18 +564,18 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148706) CPPUNIT_ASSERT_EQUAL(1, pPdfPage->getAnnotationCount()); std::unique_ptr<vcl::pdf::PDFiumAnnotation> pAnnot = pPdfPage->getAnnotation(0); - CPPUNIT_ASSERT(pAnnot->hasKey("V")); - CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("V")); - OUString aV = pAnnot->getString("V"); + CPPUNIT_ASSERT(pAnnot->hasKey("V"_ostr)); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("V"_ostr)); + OUString aV = pAnnot->getString("V"_ostr); // Without the fix in place, this test would have failed with // - Expected: 1821.84 // - Actual : CPPUNIT_ASSERT_EQUAL(OUString("1821.84"), aV); - CPPUNIT_ASSERT(pAnnot->hasKey("DV")); - CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("DV")); - OUString aDV = pAnnot->getString("DV"); + CPPUNIT_ASSERT(pAnnot->hasKey("DV"_ostr)); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFObjectType::String, pAnnot->getValueType("DV"_ostr)); + OUString aDV = pAnnot->getString("DV"_ostr); CPPUNIT_ASSERT_EQUAL(OUString("1821.84"), aDV); } @@ -586,10 +588,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) // Get access to the only image on the only page. std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"); + vcl::filter::PDFObjectElement* pResources = aPages[0]->LookupObject("Resources"_ostr); CPPUNIT_ASSERT(pResources); auto pXObjects - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pResources->Lookup("XObject"_ostr)); CPPUNIT_ASSERT(pXObjects); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pXObjects->GetItems().size()); vcl::filter::PDFObjectElement* pXObject @@ -598,10 +600,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) // Get access to the form object inside the image. auto pXObjectResources - = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources")); + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pXObject->Lookup("Resources"_ostr)); CPPUNIT_ASSERT(pXObjectResources); auto pXObjectForms = dynamic_cast<vcl::filter::PDFDictionaryElement*>( - pXObjectResources->LookupElement("XObject")); + pXObjectResources->LookupElement("XObject"_ostr)); CPPUNIT_ASSERT(pXObjectForms); vcl::filter::PDFObjectElement* pForm = pXObjectForms->LookupObject(pXObjectForms->GetItems().begin()->first); @@ -617,7 +619,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf107089) aZCodec.Decompress(pStream->GetMemory(), aObjectStream); CPPUNIT_ASSERT(aZCodec.EndCompression()); aObjectStream.Seek(0); - OString aHello("Hello"); + OString aHello("Hello"_ostr); auto pStart = static_cast<const char*>(aObjectStream.GetData()); const char* pEnd = pStart + aObjectStream.GetSize(); auto it = std::search(pStart, pEnd, aHello.getStr(), aHello.getStr() + aHello.getLength()); @@ -635,7 +637,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // The page 1 has a stream. - vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -677,7 +679,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf99680_2) for (size_t nPageNr = 0; nPageNr < aPages.size(); nPageNr++) { // Get page contents and stream. - vcl::filter::PDFObjectElement* pContents = aPages[nPageNr]->LookupObject("Contents"); + vcl::filter::PDFObjectElement* pContents = aPages[nPageNr]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -810,16 +812,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "StructElem") { - auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S")); + auto pS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("S"_ostr)); if (pS && pS->GetValue() == "Figure") { - CPPUNIT_ASSERT_EQUAL( - u"This is the text alternative - This is the description"_ustr, - ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( - *dynamic_cast<vcl::filter::PDFHexStringElement*>(pObject->Lookup("Alt")))); + CPPUNIT_ASSERT_EQUAL(u"This is the text alternative - This is the description"_ustr, + ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE( + *dynamic_cast<vcl::filter::PDFHexStringElement*>( + pObject->Lookup("Alt"_ostr)))); } } } @@ -830,9 +832,9 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testAlternativeText) auto* pCatalogDictionary = pCatalog->GetDictionary(); CPPUNIT_ASSERT(pCatalogDictionary); auto pLang = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( - pCatalogDictionary->LookupElement("Lang")); + pCatalogDictionary->LookupElement("Lang"_ostr)); CPPUNIT_ASSERT(pLang); - CPPUNIT_ASSERT_EQUAL(OString("en-US"), pLang->GetValue()); + CPPUNIT_ASSERT_EQUAL("en-US"_ostr, pLang->GetValue()); } CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) @@ -845,7 +847,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pAnnots->GetElements().size()); @@ -855,47 +857,46 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf105972) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Tx") { ++nTextFieldCount; - auto pT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T")); + auto pT + = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T"_ostr)); CPPUNIT_ASSERT(pT); - auto pAA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AA")); + auto pAA = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AA"_ostr)); CPPUNIT_ASSERT(pAA); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pAA->GetItems().size()); - auto pF = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAA->LookupElement("F")); + auto pF + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAA->LookupElement("F"_ostr)); CPPUNIT_ASSERT(pF); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pF->GetItems().size()); if (nTextFieldCount == 1) { - CPPUNIT_ASSERT_EQUAL(OString("CurrencyField"), pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("CurrencyField"_ostr, pT->GetValue()); - auto pJS - = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pF->LookupElement("JS")); - CPPUNIT_ASSERT_EQUAL( - OString("AFNumber_Format\\(4, 0, 0, 0, \"\\\\u20ac\",true\\);"), - pJS->GetValue()); + auto pJS = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pF->LookupElement("JS"_ostr)); + CPPUNIT_ASSERT_EQUAL("AFNumber_Format\\(4, 0, 0, 0, \"\\\\u20ac\",true\\);"_ostr, + pJS->GetValue()); } else if (nTextFieldCount == 2) { - CPPUNIT_ASSERT_EQUAL(OString("TimeField"), pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("TimeField"_ostr, pT->GetValue()); - auto pJS - = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pF->LookupElement("JS")); - CPPUNIT_ASSERT_EQUAL(OString("AFTime_FormatEx\\(\"h:MM:sstt\"\\);"), - pJS->GetValue()); + auto pJS = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pF->LookupElement("JS"_ostr)); + CPPUNIT_ASSERT_EQUAL("AFTime_FormatEx\\(\"h:MM:sstt\"\\);"_ostr, pJS->GetValue()); } else { - CPPUNIT_ASSERT_EQUAL(OString("DateField"), pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("DateField"_ostr, pT->GetValue()); - auto pJS - = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pF->LookupElement("JS")); - CPPUNIT_ASSERT_EQUAL(OString("AFDate_FormatEx\\(\"yy-mm-dd\"\\);"), - pJS->GetValue()); + auto pJS = dynamic_cast<vcl::filter::PDFLiteralStringElement*>( + pF->LookupElement("JS"_ostr)); + CPPUNIT_ASSERT_EQUAL("AFDate_FormatEx\\(\"yy-mm-dd\"\\);"_ostr, pJS->GetValue()); } } } @@ -911,7 +912,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442) std::vector<vcl::filter::PDFObjectElement*> aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pAnnots->GetElements().size()); @@ -921,49 +922,51 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf148442) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Btn") { ++nBtnCount; - auto pT = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T")); + auto pT + = dynamic_cast<vcl::filter::PDFLiteralStringElement*>(pObject->Lookup("T"_ostr)); CPPUNIT_ASSERT(pT); - auto pAS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("AS")); + auto pAS = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("AS"_ostr)); CPPUNIT_ASSERT(pAS); - auto pAP = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AP")); + auto pAP = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pObject->Lookup("AP"_ostr)); CPPUNIT_ASSERT(pAP); - auto pN = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAP->LookupElement("N")); + auto pN + = dynamic_cast<vcl::filter::PDFDictionaryElement*>(pAP->LookupElement("N"_ostr)); CPPUNIT_ASSERT(pN); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pN->GetItems().size()); if (nBtnCount == 1) { - CPPUNIT_ASSERT_EQUAL(OString("Checkbox1"), pT->GetValue()); - CPPUNIT_ASSERT_EQUAL(OString("Yes"), pAS->GetValue()); - CPPUNIT_ASSERT(!pN->GetItems().count("ref")); - CPPUNIT_ASSERT(pN->GetItems().count("Yes")); - CPPUNIT_ASSERT(pN->GetItems().count("Off")); + CPPUNIT_ASSERT_EQUAL("Checkbox1"_ostr, pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("Yes"_ostr, pAS->GetValue()); + CPPUNIT_ASSERT(!pN->GetItems().count("ref"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("Yes"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("Off"_ostr)); } else if (nBtnCount == 2) { - CPPUNIT_ASSERT_EQUAL(OString("Checkbox2"), pT->GetValue()); - CPPUNIT_ASSERT_EQUAL(OString("Yes"), pAS->GetValue()); + CPPUNIT_ASSERT_EQUAL("Checkbox2"_ostr, pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("Yes"_ostr, pAS->GetValue()); // Without the fix in place, this test would have failed here - CPPUNIT_ASSERT(pN->GetItems().count("ref")); - CPPUNIT_ASSERT(!pN->GetItems().count("Yes")); - CPPUNIT_ASSERT(pN->GetItems().count("Off")); + CPPUNIT_ASSERT(pN->GetItems().count("ref"_ostr)); + CPPUNIT_ASSERT(!pN->GetItems().count("Yes"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("Off"_ostr)); } else { - CPPUNIT_ASSERT_EQUAL(OString("Checkbox3"), pT->GetValue()); - CPPUNIT_ASSERT_EQUAL(OString("Off"), pAS->GetValue()); - CPPUNIT_ASSERT(pN->GetItems().count("ref")); - CPPUNIT_ASSERT(!pN->GetItems().count("Yes")); + CPPUNIT_ASSERT_EQUAL("Checkbox3"_ostr, pT->GetValue()); + CPPUNIT_ASSERT_EQUAL("Off"_ostr, pAS->GetValue()); + CPPUNIT_ASSERT(pN->GetItems().count("ref"_ostr)); + CPPUNIT_ASSERT(!pN->GetItems().count("Yes"_ostr)); // tdf#143612: Without the fix in place, this test would have failed here - CPPUNIT_ASSERT(!pN->GetItems().count("Off")); - CPPUNIT_ASSERT(pN->GetItems().count("refOff")); + CPPUNIT_ASSERT(!pN->GetItems().count("Off"_ostr)); + CPPUNIT_ASSERT(pN->GetItems().count("refOff"_ostr)); } } } @@ -980,7 +983,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf118244_radioButtonGroup) CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // There are eight radio buttons. - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); + auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots"_ostr)); CPPUNIT_ASSERT(pAnnots); CPPUNIT_ASSERT_EQUAL_MESSAGE("# of radio buttons", static_cast<size_t>(8), pAnnots->GetElements().size()); @@ -991,10 +994,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf118244_radioButtonGroup) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("FT"_ostr)); if (pType && pType->GetValue() == "Btn") { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("Kids")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObject->Lookup("Kids"_ostr)); if (pKids) { size_t expectedSize = 2; @@ -1025,11 +1028,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1065,7 +1068,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_1) "<07> <0066006C>\n" "<08> <006600660069>\n" "<09> <00660066006C>\n" - "endbfchar"); + "endbfchar"_ostr); auto pStart = static_cast<const char*>(aObjectStream.GetData()); const char* pEnd = pStart + aObjectStream.GetSize(); auto it = std::search(pStart, pEnd, aCmap.getStr(), aCmap.getStr() + aCmap.getLength()); @@ -1091,11 +1094,11 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1120,7 +1123,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf115117_2) "<05> <0648>\n" "<06> <06440627>\n" "<07> <0628>\n" - "endbfchar"); + "endbfchar"_ostr); auto pStart = static_cast<const char*>(aObjectStream.GetData()); const char* pEnd = pStart + aObjectStream.GetSize(); auto it = std::search(pStart, pEnd, aCmap.getStr(), aCmap.getStr() + aCmap.getLength()); @@ -1389,17 +1392,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { auto pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont"_ostr)); auto aName = pName->GetValue().copy(7); // skip the subset id - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", OString("Amiri-Regular"), - aName); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", "Amiri-Regular"_ostr, aName); - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1434,7 +1436,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_1) auto aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page contents and stream. - auto pContents = aPages[0]->LookupObject("Contents"); + auto pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); auto pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1486,17 +1488,17 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { auto pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont"_ostr)); auto aName = pName->GetValue().copy(7); // skip the subset id - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", OString("ReemKufi-Regular"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", "ReemKufi-Regular"_ostr, aName); - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1533,7 +1535,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_2) auto aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page contents and stream. - auto pContents = aPages[0]->LookupObject("Contents"); + auto pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); auto pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1589,17 +1591,16 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_3) auto pObject = dynamic_cast<vcl::filter::PDFObjectElement*>(aElement.get()); if (!pObject) continue; - auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type")); + auto pType = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("Type"_ostr)); if (pType && pType->GetValue() == "Font") { auto pName - = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObject->Lookup("BaseFont"_ostr)); auto aName = pName->GetValue().copy(7); // skip the subset id - CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", OString("GentiumBasic"), - aName); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font name", "GentiumBasic"_ostr, aName); - auto pToUnicodeRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObject->Lookup("ToUnicode")); + auto pToUnicodeRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObject->Lookup("ToUnicode"_ostr)); CPPUNIT_ASSERT(pToUnicodeRef); pToUnicode = pToUnicodeRef->LookupObject(); break; @@ -1630,7 +1631,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf66597_3) auto aPages = aDocument.GetPages(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aPages.size()); // Get page contents and stream. - auto pContents = aPages[0]->LookupObject("Contents"); + auto pContents = aPages[0]->LookupObject("Contents"_ostr); CPPUNIT_ASSERT(pContents); auto pStream = pContents->GetStream(); CPPUNIT_ASSERT(pStream); @@ -1879,7 +1880,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf113143) // The following check used to fail in the past, header was "%PDF-1.5": maMemory.Seek(0); - OString aExpectedHeader("%PDF-1.6"); + OString aExpectedHeader("%PDF-1.6"_ostr); OString aHeader(read_uInt8s_ToOString(maMemory, aExpectedHeader.getLength())); CPPUNIT_ASSERT_EQUAL(aExpectedHeader, aHeader); } @@ -2014,10 +2015,10 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) auto pObject1 = dynamic_cast<vcl::filter::PDFObjectElement*>(rDocElement.get()); if (!pObject1) continue; - auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type")); + auto pType1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("Type"_ostr)); if (pType1 && pType1->GetValue() == "StructElem") { - auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S")); + auto pS1 = dynamic_cast<vcl::filter::PDFNameElement*>(pObject1->Lookup("S"_ostr)); if (pS1 && pS1->GetValue() == "Document") { pDocument = pObject1; @@ -2026,7 +2027,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) } CPPUNIT_ASSERT(pDocument); - auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K")); + auto pKidsD = dynamic_cast<vcl::filter::PDFArrayElement*>(pDocument->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD); // assume there are no MCID ref at this level auto pKidsDv = pKidsD->GetElements(); @@ -2034,12 +2035,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD2); auto pObjectD2 = pRefKidD2->LookupObject(); CPPUNIT_ASSERT(pObjectD2); - auto pTypeD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD2->GetValue()); - auto pSD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Text#20body"), pSD2->GetValue()); + auto pTypeD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD2->GetValue()); + auto pSD2 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD2->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Text#20body"_ostr, pSD2->GetValue()); - auto pKidsD2 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD2->Lookup("K")); + auto pKidsD2 = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD2->Lookup("K"_ostr)); CPPUNIT_ASSERT(pKidsD2); auto pKidsD2v = pKidsD2->GetElements(); auto pRefKidD20 = dynamic_cast<vcl::filter::PDFReferenceElement*>(pKidsD2v[0]); @@ -2053,12 +2054,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD22); auto pObjectD22 = pRefKidD22->LookupObject(); CPPUNIT_ASSERT(pObjectD22); - auto pTypeD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD22->GetValue()); - auto pSD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD22->GetValue()); + auto pTypeD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD22->GetValue()); + auto pSD22 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD22->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD22->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD22->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD22->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2073,25 +2074,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2118,12 +2121,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD23); auto pObjectD23 = pRefKidD23->LookupObject(); CPPUNIT_ASSERT(pObjectD23); - auto pTypeD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD23->GetValue()); - auto pSD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD23->GetValue()); + auto pTypeD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD23->GetValue()); + auto pSD23 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD23->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD23->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD23->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD23->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2138,25 +2141,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2182,12 +2187,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD24); auto pObjectD24 = pRefKidD24->LookupObject(); CPPUNIT_ASSERT(pObjectD24); - auto pTypeD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD24->GetValue()); - auto pSD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD24->GetValue()); + auto pTypeD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD24->GetValue()); + auto pSD24 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD24->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD24->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD24->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD24->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2202,25 +2207,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2246,12 +2253,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD25); auto pObjectD25 = pRefKidD25->LookupObject(); CPPUNIT_ASSERT(pObjectD25); - auto pTypeD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD25->GetValue()); - auto pSD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD25->GetValue()); + auto pTypeD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD25->GetValue()); + auto pSD25 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD25->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD25->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD25->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD25->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2266,25 +2273,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2310,12 +2319,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(pRefKidD26); auto pObjectD26 = pRefKidD26->LookupObject(); CPPUNIT_ASSERT(pObjectD26); - auto pTypeD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("StructElem"), pTypeD26->GetValue()); - auto pSD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("S")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pSD26->GetValue()); + auto pTypeD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("StructElem"_ostr, pTypeD26->GetValue()); + auto pSD26 = dynamic_cast<vcl::filter::PDFNameElement*>(pObjectD26->Lookup("S"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pSD26->GetValue()); { - auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD26->Lookup("K")); + auto pKids = dynamic_cast<vcl::filter::PDFArrayElement*>(pObjectD26->Lookup("K"_ostr)); auto nMCID(0); auto nRef(0); for (size_t i = 0; i < pKids->GetElements().size(); ++i) @@ -2330,25 +2339,27 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) { ++nRef; auto pOType - = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type")); - CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue()); - auto pAnnotRef - = dynamic_cast<vcl::filter::PDFReferenceElement*>(pObjR->LookupElement("Obj")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pObjR->LookupElement("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("OBJR"_ostr, pOType->GetValue()); + auto pAnnotRef = dynamic_cast<vcl::filter::PDFReferenceElement*>( + pObjR->LookupElement("Obj"_ostr)); auto pAnnot = pAnnotRef->LookupObject(); - auto pAType = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type")); - CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue()); + auto pAType + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Type"_ostr)); + CPPUNIT_ASSERT_EQUAL("Annot"_ostr, pAType->GetValue()); auto pASubtype - = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype")); - CPPUNIT_ASSERT_EQUAL(OString("Link"), pASubtype->GetValue()); - auto pAContents - = dynamic_cast<vcl::filter::PDFHexStringElement*>(pAnnot->Lookup("Contents")); + = dynamic_cast<vcl::filter::PDFNameElement*>(pAnnot->Lookup("Subtype"_ostr)); + CPPUNIT_ASSERT_EQUAL("Link"_ostr, pASubtype->GetValue()); + auto pAContents = dynamic_cast<vcl::filter::PDFHexStringElement*>( + pAnnot->Lookup("Contents"_ostr)); CPPUNIT_ASSERT_EQUAL( u"Error: Reference source not found"_ustr, ::vcl::filter::PDFDocument::DecodeHexStringUTF16BE(*pAContents)); - auto pStructParent - = dynamic_cast<vcl::filter::PDFNumberElement*>(pAnnot->Lookup("StructParent")); + auto pStructParent = dynamic_cast<vcl::filter::PDFNumberElement*>( + pAnnot->Lookup("StructParent"_ostr)); CPPUNIT_ASSERT(pStructParent); // every link must have it! - auto pARect = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect")); + auto pARect + = dynamic_cast<vcl::filter::PDFArrayElement*>(pAnnot->Lookup("Rect"_ostr)); CPPUNIT_ASSERT(pARect); const auto& rElements = pARect->GetElements(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), rElements.size()); @@ -2375,7 +2386,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816) CPPUNIT_ASSERT(!pRefKidD27); // the problem was that in addition to the 5 links with SE there were 3 more - auto pAnnots = dynamic_cast<vcl::filter::PDFArrayElement*>(aPages[0]->Lookup("Annots")); ... etc. - the rest is truncated