summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-06-01 09:59:44 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-06-01 11:44:51 +0200
commitf15a6e1b1b186bf42e1ade05630d17841add2c46 (patch)
treec386e4121c710aa4aab75a3f3670885274cf97c4
parentc1893df42567c260ca5fb069038d1a55616e7b7f (diff)
Use OUString for filter
Change-Id: I45c809cfd4ee9b1c6f479db1ad0a6bf2d479fed5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152473 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/qa/extras/globalfilter/globalfilter.cxx32
-rw-r--r--sw/qa/extras/htmlexport/htmlexport.cxx22
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx2
-rw-r--r--sw/qa/inc/swmodeltestbase.hxx6
-rw-r--r--sw/qa/unit/swmodeltestbase.cxx8
5 files changed, 35 insertions, 35 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index 6351989aa541..f58f4f0b507e 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -110,7 +110,7 @@ void Test::testEmbeddedGraphicRoundtrip()
createSwDoc("document_with_two_images.odt");
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check whether graphic exported well after it was swapped out
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
@@ -166,7 +166,7 @@ void Test::testLinkedGraphicRT()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pTextDoc);
@@ -220,7 +220,7 @@ void Test::testImageWithSpecialID()
createSwDoc("images_with_special_IDs.odt");
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check whether graphic exported well
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
@@ -303,7 +303,7 @@ void Test::testGraphicShape()
createSwDoc("graphic_shape.odt");
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check whether graphic exported well
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
@@ -397,7 +397,7 @@ void Test::testMultipleIdenticalGraphics()
createSwDoc("multiple_identical_graphics.odt");
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check whether graphic exported well
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
@@ -441,7 +441,7 @@ void Test::testCharHighlightBody()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
const uno::Reference< text::XTextRange > xPara = getParagraph(1);
// Both highlight and background
@@ -524,7 +524,7 @@ void Test::testCharStyleHighlight()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
uno::Reference<beans::XPropertySet> xCharStyle;
getStyles("CharacterStyles")->getByName("charBackground") >>= xCharStyle;
@@ -688,7 +688,7 @@ void Test::testMSCharBackgroundEditing()
rOpt.SetCharBackground2Highlighting();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check whether background was exported as highlighting
xPara.set(getParagraph(1));
@@ -739,7 +739,7 @@ void Test::testCharBackgroundToHighlighting()
rOpt.SetCharBackground2Highlighting();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check highlight color
const uno::Reference< text::XTextRange > xPara = getParagraph(1);
@@ -920,7 +920,7 @@ void Test::testNestedFieldmark()
verifyNestedFieldmark(rFilterName.first + ", load", mxComponent);
// Export the document and import again
- reload(rFilterName.first.toUtf8().getStr(), nullptr);
+ reload(rFilterName.first, nullptr);
verifyNestedFieldmark(rFilterName.first + " exported-reload", mxComponent);
}
@@ -1168,7 +1168,7 @@ void Test::testBulletAsImage()
}
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
{
uno::Reference<text::XTextRange> xPara(getParagraph(1));
@@ -1773,7 +1773,7 @@ void Test::testTextFormField()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check the document after round trip
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
@@ -1826,7 +1826,7 @@ void Test::testCheckBoxFormField()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check the document after round trip
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
@@ -1879,7 +1879,7 @@ void Test::testDropDownFormField()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check the document after round trip
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
@@ -1954,7 +1954,7 @@ void Test::testDateFormField()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check the document after round trip
if (rFilterName == "writer8")
@@ -2138,7 +2138,7 @@ void Test::testDateFormFieldCharacterFormatting()
const OString sFailedMessage = OString::Concat("Failed on filter: ") + rFilterName.toUtf8();
// Export the document and import again for a check
- reload(rFilterName.toUtf8().getStr(), nullptr);
+ reload(rFilterName, nullptr);
// Check the document after round trip
if (rFilterName == "writer8")
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 6a22931d9b27..6342fe769ae7 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -407,7 +407,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testExportOfImagesWithSkipImagesEnabled)
{
createSwDoc("textAndImage.docx");
setFilterOptions("SkipImages");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
htmlDocUniquePtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT(pDoc);
@@ -420,7 +420,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testSkipImagesEmbedded)
{
createSwDoc("skipimage-embedded.doc");
setFilterOptions("SkipImages");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
// Embedded spreadsheet was exported as image, so content was lost. Make
// sure it's exported as HTML instead.
@@ -439,7 +439,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testSkipImagesEmbeddedDocument)
{
createSwDoc("skipimage-embedded-document.docx");
setFilterOptions("SkipImages");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
// Similar to testSkipImagesEmbedded, but with an embedded Writer object,
// not a Calc one, and this time OOXML, not WW8.
@@ -606,7 +606,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testEmbedImagesEnabled)
{
createSwDoc("textAndImage.docx");
setFilterOptions("EmbedImages");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
htmlDocUniquePtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT(pDoc);
@@ -625,7 +625,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testXHTML)
{
createSwWebDoc("hello.html");
setFilterOptions("XHTML");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
OString aExpected("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML");
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
@@ -646,7 +646,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfParagraph)
setImportFilterName("HTML (StarWriter)");
createSwDoc("reqif-p.xhtml");
setFilterOptions("xhtmlns=reqif-xhtml");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
@@ -809,7 +809,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfJpgImg)
setImportFilterName("HTML (StarWriter)");
createSwDoc("reqif-jpg-img.xhtml");
setFilterOptions("xhtmlns=reqif-xhtml");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
@@ -825,7 +825,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfTable)
setImportFilterName("HTML (StarWriter)");
createSwDoc("reqif-table.xhtml");
setFilterOptions("xhtmlns=reqif-xhtml");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
SvMemoryStream aStream;
WrapReqifFromTempFile(aStream);
@@ -851,7 +851,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfTable2)
{
createSwDoc("reqif-table2.odt");
setFilterOptions("xhtmlns=reqif-xhtml");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
@@ -893,7 +893,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testXHTMLUseCSS)
{
createSwDoc("xhtml-css.odt");
setFilterOptions("XHTML");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
@@ -911,7 +911,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testReqIfList)
setImportFilterName("HTML (StarWriter)");
createSwDoc("reqif-list.xhtml");
setFilterOptions("xhtmlns=reqif-xhtml");
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5207f3a8aa4d..cbca150319b7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1098,7 +1098,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115094v3)
// i.e. some unwanted ~-2mm left margin appeared.
CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(1991), pFormat->GetHoriOrient().GetPos());
}
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
// floating table is now exported directly without surrounding frame
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 244e739eb9ea..b58c487c066d 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -97,7 +97,7 @@ private:
protected:
xmlBufferPtr mpXmlBuffer;
- const char* mpFilter;
+ OUString mpFilter;
sal_uInt32 mnStartTime;
@@ -107,7 +107,7 @@ protected:
void paste(std::u16string_view aFilename, OUString aInstance, css::uno::Reference<css::text::XTextRange> const& xTextRange);
public:
- SwModelTestBase(const OUString& pTestDocumentPath = OUString(), const char* pFilter = "");
+ SwModelTestBase(const OUString& pTestDocumentPath = OUString(), const OUString& pFilter = {});
protected:
/**
@@ -261,7 +261,7 @@ protected:
void header();
- void reload(const char* pFilter, const char* pName, const char* pPassword = nullptr);
+ void reload(const OUString& pFilter, const char* pName, const char* pPassword = nullptr);
/// Combines load() and save().
void loadAndSave(const char* pName, const char* pPassword = nullptr);
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 8095d73ea9ec..e4d701fdf7ca 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -53,7 +53,7 @@ void SwModelTestBase::paste(std::u16string_view aFilename, OUString aInstance,
CPPUNIT_ASSERT(xFilter->filter(aDescriptor));
}
-SwModelTestBase::SwModelTestBase(const OUString& pTestDocumentPath, const char* pFilter)
+SwModelTestBase::SwModelTestBase(const OUString& pTestDocumentPath, const OUString& pFilter)
: UnoApiXmlTest(pTestDocumentPath)
, mbExported(false)
, mpXmlBuffer(nullptr)
@@ -474,9 +474,9 @@ void SwModelTestBase::loadURL(OUString const& rURL, const char* pName, const cha
calcLayout();
}
-void SwModelTestBase::reload(const char* pFilter, const char* pName, const char* pPassword)
+void SwModelTestBase::reload(const OUString& pFilter, const char* pName, const char* pPassword)
{
- save(OUString::createFromAscii(pFilter), pPassword);
+ save(pFilter, pPassword);
mbExported = true;
loadURL(maTempFile.GetURL(), pName, pPassword);
@@ -485,7 +485,7 @@ void SwModelTestBase::reload(const char* pFilter, const char* pName, const char*
void SwModelTestBase::loadAndSave(const char* pName, const char* pPassword)
{
load(pName, pPassword);
- save(OUString::createFromAscii(mpFilter));
+ save(mpFilter);
mbExported = true;
}