summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-06-05 10:47:35 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-06-05 12:53:41 +0200
commit2a3c206dfbba4677842b59d1ec22fd1ec957969a (patch)
treec21ede651d15477a2ae94c325564c1b2e2a308ca /sw/qa
parenta2c7244ae1ea65345ba11c1ce2501dba34b51362 (diff)
Upcoming loplugin:elidestringvar: sw
Change-Id: I3805d7a0f8f0e93463a2285a1ce52f6a5daba27d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95578 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/core/test_ToxMiscTest.cxx5
-rw-r--r--sw/qa/core/test_ToxTextGenerator.cxx15
-rw-r--r--sw/qa/core/test_ToxWhitespaceStripper.cxx51
-rw-r--r--sw/qa/extras/layout/layout.cxx10
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx24
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx12
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx3
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmllinks.cxx3
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx45
-rw-r--r--sw/qa/extras/rtfexport/rtfexport5.cxx3
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx7
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx6
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx10
13 files changed, 73 insertions, 121 deletions
diff --git a/sw/qa/core/test_ToxMiscTest.cxx b/sw/qa/core/test_ToxMiscTest.cxx
index 67a6320cf81b..ac679250a09b 100644
--- a/sw/qa/core/test_ToxMiscTest.cxx
+++ b/sw/qa/core/test_ToxMiscTest.cxx
@@ -24,11 +24,8 @@ public:
void ToxMiscTest::testTdf73162()
{
- //input token string
- OUString tokenString = "<LS Index Link,65535,><E# ,65535,0,10><X ,65535,\001.\001><ET ,65535,><T ,65535,0,5,.,1><# ,65535,><LE ,65535,>";
-
//create Tokens with the help of input string
- SwFormTokensHelper tokensHelper(tokenString);
+ SwFormTokensHelper tokensHelper("<LS Index Link,65535,><E# ,65535,0,10><X ,65535,\001.\001><ET ,65535,><T ,65535,0,5,.,1><# ,65535,><LE ,65535,>"); //input token string
SwFormTokens formTokens = tokensHelper.GetTokens();
//check the size of token vector / count of tokens
diff --git a/sw/qa/core/test_ToxTextGenerator.cxx b/sw/qa/core/test_ToxTextGenerator.cxx
index a2d347536a65..c0b667a27334 100644
--- a/sw/qa/core/test_ToxTextGenerator.cxx
+++ b/sw/qa/core/test_ToxTextGenerator.cxx
@@ -70,25 +70,22 @@ struct MockedSortTab : public SwTOXSortTabBase {
void
ToxTextGeneratorTest::EmptyStringIsReturnedForPageNumberPlaceholderOfZeroItems()
{
- OUString const expected("");
OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(0);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ CPPUNIT_ASSERT_EQUAL(OUString(""), actual);
}
void
ToxTextGeneratorTest::OneAtSignIsReturnedForPageNumberPlaceholderOfOneItem()
{
- OUString const expected("@~");
OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(1);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ CPPUNIT_ASSERT_EQUAL(OUString("@~"), actual);
}
void
ToxTextGeneratorTest::TwoAtSignsAreReturnedForPageNumberPlaceholderOfOneItem()
{
- OUString const expected("@, @~");
OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(2);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ CPPUNIT_ASSERT_EQUAL(OUString("@, @~"), actual);
}
void
@@ -97,9 +94,8 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfNoTextMarkIsSet()
MockedSortTab sortTab;
sortTab.pTextMark = nullptr;
- OUString const expected("");
OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0, nullptr);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ CPPUNIT_ASSERT_EQUAL(OUString(""), actual);
}
void
@@ -108,9 +104,8 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfToxSourcesIsEmpty()
MockedSortTab sortTab;
sortTab.pTextMark = reinterpret_cast<SwTextTOXMark*>(1);
- OUString const expected("");
OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0, nullptr);
- CPPUNIT_ASSERT_EQUAL(expected, actual);
+ CPPUNIT_ASSERT_EQUAL(OUString(""), actual);
}
namespace {
diff --git a/sw/qa/core/test_ToxWhitespaceStripper.cxx b/sw/qa/core/test_ToxWhitespaceStripper.cxx
index 430cc78b7686..e8303ab3da73 100644
--- a/sw/qa/core/test_ToxWhitespaceStripper.cxx
+++ b/sw/qa/core/test_ToxWhitespaceStripper.cxx
@@ -47,16 +47,14 @@ void
ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks()
{
{
- OUString const test("abc\n");
- ToxWhitespaceStripper sut(test);
+ ToxWhitespaceStripper sut("abc\n");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), sut.GetPositionInStrippedString(2));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(3));
}
{
- OUString const test("abc\n\n");
- ToxWhitespaceStripper sut(test);
+ ToxWhitespaceStripper sut("abc\n\n");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), sut.GetPositionInStrippedString(2));
@@ -64,8 +62,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks()
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(4));
}
{
- OUString const test("abc\ndef");
- ToxWhitespaceStripper sut(test);
+ ToxWhitespaceStripper sut("abc\ndef");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), sut.GetPositionInStrippedString(2));
@@ -76,10 +73,9 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks()
}
{
// 012345 6789
- OUString const test(" abc \ndef");
// 01234567
// " abc def"
- ToxWhitespaceStripper sut(test);
+ ToxWhitespaceStripper sut(" abc \ndef");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(1));
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(2));
@@ -97,40 +93,28 @@ void
ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks()
{
{
- OUString const test("abc\n");
- OUString const expected("abc");
- ToxWhitespaceStripper sut(test);
- CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString());
+ ToxWhitespaceStripper sut("abc\n");
+ CPPUNIT_ASSERT_EQUAL(OUString("abc"), sut.GetStrippedString());
}
{
- OUString const test("abc\n\n");
- OUString const expected("abc");
- ToxWhitespaceStripper sut(test);
- CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString());
+ ToxWhitespaceStripper sut("abc\n\n");
+ CPPUNIT_ASSERT_EQUAL(OUString("abc"), sut.GetStrippedString());
}
{
- OUString const test("abc\ndef");
- OUString const expected("abc def");
- ToxWhitespaceStripper sut(test);
- CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString());
+ ToxWhitespaceStripper sut("abc\ndef");
+ CPPUNIT_ASSERT_EQUAL(OUString("abc def"), sut.GetStrippedString());
}
{
- OUString const test(" abc \ndef");
- OUString const expected(" abc def");
- ToxWhitespaceStripper sut(test);
- CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString());
+ ToxWhitespaceStripper sut(" abc \ndef");
+ CPPUNIT_ASSERT_EQUAL(OUString(" abc def"), sut.GetStrippedString());
}
{
- OUString const test(" ");
- OUString const expected("");
- ToxWhitespaceStripper sut(test);
- CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString());
+ ToxWhitespaceStripper sut(" ");
+ CPPUNIT_ASSERT_EQUAL(OUString(""), sut.GetStrippedString());
}
{
- OUString const test("d ");
- OUString const expected("d");
- ToxWhitespaceStripper sut(test);
- CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString());
+ ToxWhitespaceStripper sut("d ");
+ CPPUNIT_ASSERT_EQUAL(OUString("d"), sut.GetStrippedString());
}
}
@@ -146,8 +130,7 @@ ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested()
void
ToxWhitespaceStripperTest::InvalidPositionIsMappedToLastEntry()
{
- OUString const test("ab c");
- ToxWhitespaceStripper sut(test);
+ ToxWhitespaceStripper sut("ab c");
sal_Int32 const expected = 4; // the length of the string after merging the two whitespaces
sal_Int32 result = sut.GetPositionInStrippedString(40); // a value past the original string length
CPPUNIT_ASSERT_EQUAL(expected, result);
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 96c6edc51634..df50e7f9e253 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2870,13 +2870,11 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118672)
if (!xHyphenator->hasLocale(lang::Locale("en", "US", OUString())))
return;
- const OUString aLine1(
- "He heard quiet steps behind him. That didn't bode well. Who could be fol*1 2 "
- "3 4 5 6 7 8 9 10con-");
// This ended as "fol*1 2 3 4 5 6 7 8 9", i.e. "10con-" was moved to the next line.
- assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[1]", "Line", aLine1);
- const OUString aLine2("setetur");
- assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[2]", "Line", aLine2);
+ assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[1]", "Line",
+ "He heard quiet steps behind him. That didn't bode well. Who could be fol*1 2 "
+ "3 4 5 6 7 8 9 10con-");
+ assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[2]", "Line", "setetur");
}
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117923)
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 43a9a2ab1286..728ed037a54c 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -116,13 +116,11 @@ DECLARE_ODFEXPORT_TEST(testMathObjectFlatExport, "2_MathType3.docx")
static void testTdf43569_CheckIfFieldParse()
{
{
- const OUString fieldDefinition("IF A B C");
-
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
- SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse);
+ SwHiddenTextField::ParseIfFieldDefinition("IF A B C", paramCondition, paramTrue, paramFalse);
CPPUNIT_ASSERT_EQUAL(OUString("A"), paramCondition);
CPPUNIT_ASSERT_EQUAL(OUString("B"), paramTrue);
@@ -130,13 +128,11 @@ static void testTdf43569_CheckIfFieldParse()
}
{
- const OUString fieldDefinition(" IF AAA BBB CCC ");
-
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
- SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse);
+ SwHiddenTextField::ParseIfFieldDefinition(" IF AAA BBB CCC ", paramCondition, paramTrue, paramFalse);
CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition);
CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue);
@@ -144,13 +140,11 @@ static void testTdf43569_CheckIfFieldParse()
}
{
- const OUString fieldDefinition(" IF AAA \"BBB\" \"CCC\" ");
-
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
- SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse);
+ SwHiddenTextField::ParseIfFieldDefinition(" IF AAA \"BBB\" \"CCC\" ", paramCondition, paramTrue, paramFalse);
CPPUNIT_ASSERT_EQUAL(OUString("AAA"), paramCondition);
CPPUNIT_ASSERT_EQUAL(OUString("BBB"), paramTrue);
@@ -159,13 +153,11 @@ static void testTdf43569_CheckIfFieldParse()
// true-case and false-case have spaces inside
{
- const OUString fieldDefinition(" IF A A A \"B B B\" \"C C C\" ");
-
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
- SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse);
+ SwHiddenTextField::ParseIfFieldDefinition(" IF A A A \"B B B\" \"C C C\" ", paramCondition, paramTrue, paramFalse);
CPPUNIT_ASSERT_EQUAL(OUString("A A A"), paramCondition);
CPPUNIT_ASSERT_EQUAL(OUString("B B B"), paramTrue);
@@ -174,13 +166,11 @@ static void testTdf43569_CheckIfFieldParse()
// true-case and false-case have leading/trailing space
{
- const OUString fieldDefinition("IF A1 A2 A3 \"B1 B2 \" \" C1 C2\" ");
-
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
- SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse);
+ SwHiddenTextField::ParseIfFieldDefinition("IF A1 A2 A3 \"B1 B2 \" \" C1 C2\" ", paramCondition, paramTrue, paramFalse);
CPPUNIT_ASSERT_EQUAL(OUString("A1 A2 A3"), paramCondition);
CPPUNIT_ASSERT_EQUAL(OUString("B1 B2 "), paramTrue);
@@ -189,13 +179,11 @@ static void testTdf43569_CheckIfFieldParse()
// true-case and false-case are empty
{
- const OUString fieldDefinition("IF condition \"\" \"\" ");
-
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
- SwHiddenTextField::ParseIfFieldDefinition(fieldDefinition, paramCondition, paramTrue, paramFalse);
+ SwHiddenTextField::ParseIfFieldDefinition("IF condition \"\" \"\" ", paramCondition, paramTrue, paramFalse);
CPPUNIT_ASSERT_EQUAL(OUString("condition"), paramCondition);
CPPUNIT_ASSERT_EQUAL(OUString(""), paramTrue);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 4dd7062c6e17..c1890a33c2cd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -553,8 +553,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx")
comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
//check that images are also saved
- OUString const sImageFile( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a unique name
- uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName( sImageFile ), uno::UNO_QUERY);
+ uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName( "word/media/OOXDiagramDataRels1_0.jpeg" /*added anchor id to form a unique name*/ ), uno::UNO_QUERY);
CPPUNIT_ASSERT( xInputStream.is() );
}
@@ -580,13 +579,11 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx")
comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
//check that images are also saved
- OUString const sImageFile1( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a unique name
- uno::Reference<io::XInputStream> xInputStream1(xNameAccess->getByName( sImageFile1 ), uno::UNO_QUERY);
+ uno::Reference<io::XInputStream> xInputStream1(xNameAccess->getByName( "word/media/OOXDiagramDataRels1_0.jpeg" /*added anchor id to form a unique name*/ ), uno::UNO_QUERY);
CPPUNIT_ASSERT( xInputStream1.is() );
//check that images are saved for other smart-arts as well.
- OUString const sImageFile2( "word/media/OOXDiagramDataRels2_0.jpeg" ); //added anchor id to form a unique name
- uno::Reference<io::XInputStream> xInputStream2(xNameAccess->getByName( sImageFile2 ), uno::UNO_QUERY);
+ uno::Reference<io::XInputStream> xInputStream2(xNameAccess->getByName( "word/media/OOXDiagramDataRels2_0.jpeg" /*added anchor id to form a unique name*/ ), uno::UNO_QUERY);
CPPUNIT_ASSERT( xInputStream2.is() );
}
@@ -1019,10 +1016,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx")
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
- const OUString aMustHaveText = "Requerimientos del Cliente";
const OUString aActualText = xCell->getString();
- CPPUNIT_ASSERT(aActualText.indexOf(aMustHaveText) > 0);
+ CPPUNIT_ASSERT(aActualText.indexOf("Requerimientos del Cliente") > 0);
}
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 690309b6827f..092a17646002 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -575,8 +575,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123262_textFootnoteSeparators, "tdf123262_textFo
uno::Reference<text::XText> xFootnoteText(xFootnotes->getByIndex(0), uno::UNO_QUERY);
// The text in the separator footnote should not be added to the footnotes
- OUString sText = " Microsoft Office.";
- CPPUNIT_ASSERT_EQUAL(sText, xFootnoteText->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString(" Microsoft Office."), xFootnoteText->getString());
// Ensure that paragraph markers are not lost.
xFootnoteText.set(xFootnotes->getByIndex(1), uno::UNO_QUERY);
diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
index 1ad0df5fb514..8be5c38a92f7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
@@ -257,9 +257,8 @@ DECLARE_LINKS_EXPORT_TEST(testNon_ascii_link_export, "non_ascii_link.docx", USE_
if (!pXmlDoc)
return;
- OUString sTarget = "file:///C:/TEMP/%C3%A9kezet.docx";
assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[@TargetMode='External']", "Target",
- INetURLObject::decode( sTarget, INetURLObject::DecodeMechanism::ToIUri,
+ INetURLObject::decode( OUString("file:///C:/TEMP/%C3%A9kezet.docx"), INetURLObject::DecodeMechanism::ToIUri,
RTL_TEXTENCODING_UTF8));
}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 4fec96ab05d5..7bae2b0eab9f 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -200,28 +200,30 @@ DECLARE_RTFEXPORT_TEST(testCommentsNested, "comments-nested.odt")
DECLARE_RTFEXPORT_TEST(testMathAccents, "math-accents.rtf")
{
OUString aActual = getFormula(getRun(getParagraph(1), 1));
- OUString const aExpected("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} "
- "widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde "
- "{a} underline {a}");
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} "
+ "widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde "
+ "{a} underline {a}"),
+ aActual);
}
DECLARE_RTFEXPORT_TEST(testMathEqarray, "math-eqarray.rtf")
{
OUString aActual = getFormula(getRun(getParagraph(1), 1));
- OUString const aExpected(
- "y = left lbrace stack { 0 , x < 0 # 1 , x = 0 # {x} ^ {2} , x > 0 } right none");
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("y = left lbrace stack { 0 , x < 0 # 1 , x = 0 # {x} ^ {2} , x > 0 } right none"),
+ aActual);
}
DECLARE_RTFEXPORT_TEST(testMathD, "math-d.rtf")
{
OUString aActual = getFormula(getRun(getParagraph(1), 1));
- OUString const aExpected("left (x mline y mline z right ) left (1 right ) left [2 right ] left "
- "ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 "
- "right rdline left langle 6 right rangle left langle a mline b right "
- "rangle left ({x} over {y} right )");
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("left (x mline y mline z right ) left (1 right ) left [2 right ] left "
+ "ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 "
+ "right rdline left langle 6 right rangle left langle a mline b right "
+ "rangle left ({x} over {y} right )"),
+ aActual);
}
DECLARE_RTFEXPORT_TEST(testMathEscaping, "math-escaping.rtf")
@@ -241,15 +243,13 @@ DECLARE_RTFEXPORT_TEST(testMathLim, "math-lim.rtf")
DECLARE_RTFEXPORT_TEST(testMathMatrix, "math-matrix.rtf")
{
OUString aActual = getFormula(getRun(getParagraph(1), 1));
- OUString const aExpected("left [matrix {1 # 2 ## 3 # 4} right ]");
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(OUString("left [matrix {1 # 2 ## 3 # 4} right ]"), aActual);
}
DECLARE_RTFEXPORT_TEST(testMathBox, "math-mbox.rtf")
{
OUString aActual = getFormula(getRun(getParagraph(1), 1));
- OUString const aExpected("a");
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(OUString("a"), aActual);
}
DECLARE_RTFEXPORT_TEST(testMathMso2007, "math-mso2007.rtf")
@@ -301,8 +301,8 @@ DECLARE_RTFEXPORT_TEST(testMathMso2007, "math-mso2007.rtf")
DECLARE_RTFEXPORT_TEST(testMathNary, "math-nary.rtf")
{
OUString aActual = getFormula(getRun(getParagraph(1), 1));
- OUString const aExpected("lllint from {1} to {2} {x + 1} prod from {a} {b} sum to {2} {x}");
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("lllint from {1} to {2} {x + 1} prod from {a} {b} sum to {2} {x}"), aActual);
}
DECLARE_RTFEXPORT_TEST(testMathLimupp, "math-limupp.rtf")
@@ -341,10 +341,11 @@ DECLARE_RTFEXPORT_TEST(testMathSepchr, "math-sepchr.rtf")
DECLARE_RTFEXPORT_TEST(testMathSubscripts, "math-subscripts.rtf")
{
OUString aActual = getFormula(getRun(getParagraph(1), 1));
- OUString const aExpected("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} "
- "{x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub "
- "{2} rsup {1}");
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(
+ OUString("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} "
+ "{x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub "
+ "{2} rsup {1}"),
+ aActual);
}
DECLARE_RTFEXPORT_TEST(testMathVerticalstacks, "math-vertical-stacks.rtf")
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 12023f321232..23f83a17149b 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -339,10 +339,9 @@ DECLARE_RTFEXPORT_TEST(testCp1000018, "cp1000018.rtf")
uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
- OUString const aExpected = "Footnote first line." SAL_NEWLINE_STRING;
OUString const aActual = xTextRange->getString();
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(OUString("Footnote first line." SAL_NEWLINE_STRING), aActual);
}
DECLARE_RTFEXPORT_TEST(testFdo94835, "fdo94835.rtf")
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index cf9d5dd31309..1e960e443079 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -969,9 +969,8 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo82114)
uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>(
getStyles("PageStyles")->getByName("Converted1"), "HeaderText");
OUString aActual = xHeaderText->getString();
- OUString const aExpected("First page header, section 2");
// This was 'Right page header, section 1'.
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 2"), aActual);
}
CPPUNIT_TEST_FIXTURE(Test, testFdo44984)
@@ -1442,11 +1441,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108947)
//Document is very fragile, hence we need this guard.
#if HAVE_MORE_FONTS
- OUString aExpected = SAL_NEWLINE_STRING SAL_NEWLINE_STRING "Header Page 2 ?";
uno::Reference<text::XText> xHeaderTextLeft = getProperty<uno::Reference<text::XText>>(
getStyles("PageStyles")->getByName("Default Page Style"), "HeaderTextLeft");
aActual = xHeaderTextLeft->getString();
- CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+ CPPUNIT_ASSERT_EQUAL(OUString(SAL_NEWLINE_STRING SAL_NEWLINE_STRING "Header Page 2 ?"),
+ aActual);
#endif
}
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 91e493af1960..d7b01b9bbb96 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1157,12 +1157,11 @@ void SwUiWriterTest::testWatermarkPosition()
SwDoc* pDoc = createDoc("watermark-position.odt");
SwEditShell* pEditShell = pDoc->GetEditShell();
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
- const OUString rPageStyleName = "Default Page Style";
uno::Reference<frame::XModel> xModel = pDoc->GetDocShell()->GetBaseModel();
uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY);
uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName("Default Page Style"), uno::UNO_QUERY);
// 1. Add additional page breaks
for (int j = 0; j < aAdditionalPagesCount[i]; ++j)
@@ -2736,13 +2735,12 @@ void SwUiWriterTest::testTdf73660()
OUString aData2 = "Seco" + OUStringChar(CHAR_SOFTHYPHEN) + "nd";
OUString aData3 = OUStringChar(CHAR_SOFTHYPHEN) + "Third";
OUString aData4 = "Fourth" + OUStringChar(CHAR_SOFTHYPHEN);
- OUString aData5 = "Fifth";
pWrtShell->Insert("We are inserting some text in the document to check the search feature ");
pWrtShell->Insert(aData1 + " ");
pWrtShell->Insert(aData2 + " ");
pWrtShell->Insert(aData3 + " ");
pWrtShell->Insert(aData4 + " ");
- pWrtShell->Insert(aData5 + " ");
+ pWrtShell->Insert("Fifth ");
pWrtShell->Insert("Now we have enough text let's test search for all the cases");
//searching for all 5 strings entered with soft-hyphen, search string contains no soft-hyphen
i18nutil::SearchOptions2 searchOpt;
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 691d385d6de7..f9040938ef56 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -555,11 +555,11 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testSelectionInTableEnumEnd)
CPPUNIT_ASSERT(xSelections.is());
uno::Reference<text::XTextRange> xSelection(xSelections->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xSelection.is());
- OUString aExpectedSelection
- = "Before" SAL_NEWLINE_STRING "A1" SAL_NEWLINE_STRING "B1" SAL_NEWLINE_STRING
- "C2" SAL_NEWLINE_STRING "A2" SAL_NEWLINE_STRING "B2" SAL_NEWLINE_STRING
- "C2" SAL_NEWLINE_STRING;
- CPPUNIT_ASSERT_EQUAL(aExpectedSelection, xSelection->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("Before" SAL_NEWLINE_STRING "A1" SAL_NEWLINE_STRING
+ "B1" SAL_NEWLINE_STRING "C2" SAL_NEWLINE_STRING
+ "A2" SAL_NEWLINE_STRING "B2" SAL_NEWLINE_STRING
+ "C2" SAL_NEWLINE_STRING),
+ xSelection->getString());
// Enumerate paragraphs in the selection.
uno::Reference<container::XEnumerationAccess> xCursor(