diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-27 11:12:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-27 13:06:59 +0200 |
commit | e5ece062058f7772f8414d47d07bb8af6e8e5c2a (patch) | |
tree | 97ab9340c5e29f5445279a9585b4abe42396b14d /sw/qa/core | |
parent | 2d5090419e0113f5b411ee84bfc55926a19da411 (diff) |
loplugin:oncevar in sw
Change-Id: Ia96172489eec09607113d388a5b683bb6e0d2dec
Reviewed-on: https://gerrit.libreoffice.org/39290
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa/core')
-rw-r--r-- | sw/qa/core/macros-test.cxx | 3 | ||||
-rw-r--r-- | sw/qa/core/test_ToxTextGenerator.cxx | 10 | ||||
-rw-r--r-- | sw/qa/core/test_ToxWhitespaceStripper.cxx | 38 | ||||
-rw-r--r-- | sw/qa/core/uwriter.cxx | 2 |
4 files changed, 25 insertions, 28 deletions
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index b356a5f237fc..cc75587a04dd 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -159,11 +159,10 @@ void SwMacrosTest::testVba() OUString("vnd.sun.Star.script:Project.NewMacros.Macro1?language=Basic&location=document") } }; - OUString aFileExtension( "doc" ); for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( testInfo ); ++i ) { OUString aFileName; - createFileURL(testInfo[i].sFileBaseName, aFileExtension, aFileName); + createFileURL(testInfo[i].sFileBaseName, "doc", aFileName); uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.text.TextDocument"); OUStringBuffer sMsg( "Failed to load " ); sMsg.append ( aFileName ); diff --git a/sw/qa/core/test_ToxTextGenerator.cxx b/sw/qa/core/test_ToxTextGenerator.cxx index 2a41c9844201..a9b280f59994 100644 --- a/sw/qa/core/test_ToxTextGenerator.cxx +++ b/sw/qa/core/test_ToxTextGenerator.cxx @@ -61,7 +61,7 @@ struct MockedSortTab : public SwTOXSortTabBase { void ToxTextGeneratorTest::EmptyStringIsReturnedForPageNumberPlaceholderOfZeroItems() { - OUString expected(""); + OUString const expected(""); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(0); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -69,7 +69,7 @@ ToxTextGeneratorTest::EmptyStringIsReturnedForPageNumberPlaceholderOfZeroItems() void ToxTextGeneratorTest::OneAtSignIsReturnedForPageNumberPlaceholderOfOneItem() { - OUString expected("@~"); + OUString const expected("@~"); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(1); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -77,7 +77,7 @@ ToxTextGeneratorTest::OneAtSignIsReturnedForPageNumberPlaceholderOfOneItem() void ToxTextGeneratorTest::TwoAtSignsAreReturnedForPageNumberPlaceholderOfOneItem() { - OUString expected("@, @~"); + OUString const expected("@, @~"); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(2); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -88,7 +88,7 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfNoTextMarkIsSet() MockedSortTab sortTab; sortTab.pTextMark = nullptr; - OUString expected(""); + OUString const expected(""); OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -99,7 +99,7 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfToxSourcesIsEmpty() MockedSortTab sortTab; sortTab.pTextMark = reinterpret_cast<SwTextTOXMark*>(1); - OUString expected(""); + OUString const expected(""); OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0); CPPUNIT_ASSERT_EQUAL(expected, actual); } diff --git a/sw/qa/core/test_ToxWhitespaceStripper.cxx b/sw/qa/core/test_ToxWhitespaceStripper.cxx index 53819333579e..dc3b23b828aa 100644 --- a/sw/qa/core/test_ToxWhitespaceStripper.cxx +++ b/sw/qa/core/test_ToxWhitespaceStripper.cxx @@ -49,7 +49,7 @@ void ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() { { - OUString test("abc\n"); + OUString const test("abc\n"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); @@ -57,7 +57,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(3)); } { - OUString test("abc\n\n"); + OUString const test("abc\n\n"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); @@ -66,7 +66,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(4)); } { - OUString test("abc\ndef"); + OUString const test("abc\ndef"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); @@ -78,7 +78,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() } { // 012345 6789 - OUString test(" abc \ndef"); + OUString const test(" abc \ndef"); // 01234567 // " abc def" ToxWhitespaceStripper sut(test); @@ -99,38 +99,38 @@ void ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks() { { - OUString test("abc\n"); - OUString expected("abc"); + OUString const test("abc\n"); + OUString const expected("abc"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test("abc\n\n"); - OUString expected("abc"); + OUString const test("abc\n\n"); + OUString const expected("abc"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test("abc\ndef"); - OUString expected("abc def"); + OUString const test("abc\ndef"); + OUString const expected("abc def"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test(" abc \ndef"); - OUString expected(" abc def"); + OUString const test(" abc \ndef"); + OUString const expected(" abc def"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test(" "); - OUString expected(""); + OUString const test(" "); + OUString const expected(""); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test("d "); - OUString expected("d"); + OUString const test("d "); + OUString const expected("d"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } @@ -139,7 +139,7 @@ ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks() void ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested() { - OUString test("abc"); + OUString const test("abc"); ToxWhitespaceStripper sut(test); sal_Int32 expected = test.getLength(); CPPUNIT_ASSERT_EQUAL(expected, sut.GetPositionInStrippedString(test.getLength())); @@ -148,9 +148,9 @@ ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested() void ToxWhitespaceStripperTest::InvalidPositionIsMappedToLastEntry() { - OUString test("ab c"); + OUString const test("ab c"); ToxWhitespaceStripper sut(test); - sal_Int32 expected = 4; // the length of the string after merging the two whitespaces + 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/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 4148d93c40f2..b6bb8526b6b0 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1559,13 +1559,11 @@ void SwDocTest::testClientModify() CPPUNIT_ASSERT_EQUAL(aClient1.GetRegisteredIn(), static_cast<SwModify*>(nullptr)); CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(), static_cast<SwModify*>(nullptr)); { - int nCount = 0; SwIterator<TestClient,SwModify> aIter(aMod); for(TestClient* pClient = aIter.First(); pClient ; pClient = aIter.Next()) { CPPUNIT_ASSERT(false); } - CPPUNIT_ASSERT_EQUAL(nCount,0); } aMod.ModifyBroadcast(nullptr, nullptr); CPPUNIT_ASSERT_EQUAL(aClient1.m_nModifyCount,2); |