diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-06-05 11:12:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-06-05 15:26:36 +0200 |
commit | 5a7dd1f3e0d95e67c44d36c20f8ba5c8791b3aa3 (patch) | |
tree | 6127891a36c202f9c651c976bb2f2179dee463c7 /test | |
parent | fd6f0ad3d522a1ab37e6b4659346d4a73db178f8 (diff) |
Upcoming loplugin:elidestringvar: test
Change-Id: Id28d83963443e85bf8309bf41fa28140c4070af8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95580
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/source/sheet/datapilotitem.cxx | 4 | ||||
-rw-r--r-- | test/source/sheet/xcellrangesquery.cxx | 21 | ||||
-rw-r--r-- | test/source/sheet/xnamedrange.cxx | 3 | ||||
-rw-r--r-- | test/source/sheet/xnamedranges.cxx | 15 | ||||
-rw-r--r-- | test/source/sheet/xspreadsheets2.cxx | 7 |
5 files changed, 16 insertions, 34 deletions
diff --git a/test/source/sheet/datapilotitem.cxx b/test/source/sheet/datapilotitem.cxx index 33fe34920ee2..ac505afb7ff5 100644 --- a/test/source/sheet/datapilotitem.cxx +++ b/test/source/sheet/datapilotitem.cxx @@ -51,10 +51,8 @@ void DataPilotItem::testProperties() CPPUNIT_ASSERT_MESSAGE("Value of ShowDetail wasn't changed", bShowDetail); - const OUString propNameP("Position"); - sal_Int32 nPosition = 42; - CPPUNIT_ASSERT(xItem->getPropertyValue(propNameP) >>= nPosition); + CPPUNIT_ASSERT(xItem->getPropertyValue("Position") >>= nPosition); CPPUNIT_ASSERT_EQUAL_MESSAGE("Default Position already changed", sal_Int32(0), nPosition); // FIXME: This throws somehow a com.sun.star.lang.IllegalArgumentException diff --git a/test/source/sheet/xcellrangesquery.cxx b/test/source/sheet/xcellrangesquery.cxx index e8e1b4724cba..55d24224ab7a 100644 --- a/test/source/sheet/xcellrangesquery.cxx +++ b/test/source/sheet/xcellrangesquery.cxx @@ -24,72 +24,65 @@ namespace apitest { void XCellRangesQuery::testQueryColumnDifference() { - OUString const aExpected( "Sheet1.B1:C1,Sheet1.B3:C5" ); uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryColumnDifferences(table::CellAddress(0, 1, 1)); OUString aResult = xRanges->getRangeAddressesAsString(); std::cout << "testQueryColumnDifference: Result: " << aResult << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryColumnDifference", aExpected, aResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryColumnDifference", OUString( "Sheet1.B1:C1,Sheet1.B3:C5" ), aResult); } void XCellRangesQuery::testQueryContentDifference() { - OUString const aExpected( "Sheet1.B3,Sheet1.C2" ); uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryContentCells(sheet::CellFlags::VALUE); OUString aResult = xRanges->getRangeAddressesAsString(); std::cout << "testQueryContentDifference: Result: " << aResult << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryContentDifference", aExpected, aResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryContentDifference", OUString( "Sheet1.B3,Sheet1.C2" ), aResult); } void XCellRangesQuery::testQueryEmptyCells() { - OUString const aExpected( "Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:E5" ); uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryEmptyCells(); OUString aResult = xRanges->getRangeAddressesAsString(); std::cout << "testQueryEmptyCells: Result: " << aResult << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryEmptyCells", aExpected, aResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryEmptyCells", OUString( "Sheet1.A1:A5,Sheet1.B1:C1,Sheet1.B5,Sheet1.C3:C5,Sheet1.D1:E5" ), aResult); } void XCellRangesQuery::testQueryFormulaCells() { - OUString const aExpected( "Sheet1.B2" ); uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryFormulaCells(sheet::CellFlags::FORMULA); OUString aResult = xRanges->getRangeAddressesAsString(); std::cout << "testQueryFormulaCells: Result: " << aResult << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryFormulaCells", aExpected, aResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryFormulaCells", OUString( "Sheet1.B2" ), aResult); } void XCellRangesQuery::testQueryIntersection() { - OUString const aExpected( "Sheet1.D4:E5" ); uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryIntersection(table::CellRangeAddress(0,3,3,7,7)); OUString aResult = xRanges->getRangeAddressesAsString(); std::cout << "testQueryIntersection: Result: " << aResult << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryIntersection", aExpected, aResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryIntersection", OUString( "Sheet1.D4:E5" ), aResult); } void XCellRangesQuery::testQueryRowDifference() { - OUString const aExpected( "Sheet1.A2:A4,Sheet1.C2:E4" ); uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryRowDifferences(table::CellAddress(0,1,1)); OUString aResult = xRanges->getRangeAddressesAsString(); std::cout << "testQueryRowDifference: Result: " << aResult << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryRowDifference", aExpected, aResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryRowDifference", OUString( "Sheet1.A2:A4,Sheet1.C2:E4" ), aResult); } void XCellRangesQuery::testQueryVisibleCells() { - OUString const aExpected( "Sheet1.A1:E5" ); uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery(init(),UNO_QUERY_THROW); uno::Reference<sheet::XSheetCellRanges> xRanges = xCellRangesQuery->queryVisibleCells(); OUString aResult = xRanges->getRangeAddressesAsString(); std::cout << "testQueryVisibleCells: Result: " << aResult << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryVisibleCells", aExpected, aResult); + CPPUNIT_ASSERT_EQUAL_MESSAGE("testQueryVisibleCells", OUString( "Sheet1.A1:E5" ), aResult); } } diff --git a/test/source/sheet/xnamedrange.cxx b/test/source/sheet/xnamedrange.cxx index f75174560fdf..ea9fb778199a 100644 --- a/test/source/sheet/xnamedrange.cxx +++ b/test/source/sheet/xnamedrange.cxx @@ -25,8 +25,7 @@ void XNamedRange::testGetContent() { uno::Reference< sheet::XNamedRange > xNamedRange = getNamedRange("initial1"); - OUString const aExpectedContent("$Sheet1.$B$1"); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected content for initial1 on GetContent", aExpectedContent, xNamedRange->getContent()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong expected content for initial1 on GetContent", OUString("$Sheet1.$B$1"), xNamedRange->getContent()); } void XNamedRange::testSetContent() diff --git a/test/source/sheet/xnamedranges.cxx b/test/source/sheet/xnamedranges.cxx index 3faa61893aa2..c4d272cdcc39 100644 --- a/test/source/sheet/xnamedranges.cxx +++ b/test/source/sheet/xnamedranges.cxx @@ -42,37 +42,32 @@ void XNamedRanges::testAddNewByName() table::CellAddress aBaseAddress(0, 0, 0); sal_Int32 nType = 0; - OUString const aContent1("D1"); OUString aName1("type_0"); - xNamedRanges->addNewByName(aName1, aContent1, aBaseAddress, nType); + xNamedRanges->addNewByName(aName1, "D1", aBaseAddress, nType); CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type 0 - Normal case", xNamedRanges->hasByName(aName1)); nType = ::sheet::NamedRangeFlag::COLUMN_HEADER; - OUString const aContent2("D2"); OUString aName2("type_COLUMN_HEADER"); - xNamedRanges->addNewByName(aName2, aContent2, aBaseAddress, nType); + xNamedRanges->addNewByName(aName2, "D2", aBaseAddress, nType); CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type COLUMN_HEADER", xNamedRanges->hasByName(aName2)); nType = ::sheet::NamedRangeFlag::FILTER_CRITERIA; - OUString const aContent3("D3"); OUString aName3("type_FILTER_CRITERIA"); - xNamedRanges->addNewByName(aName3, aContent3, aBaseAddress, nType); + xNamedRanges->addNewByName(aName3, "D3", aBaseAddress, nType); CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type FILTER_CRITERIA", xNamedRanges->hasByName(aName3)); nType = ::sheet::NamedRangeFlag::PRINT_AREA; - OUString const aContent4("D4"); OUString aName4("type_PRINT_AREA"); - xNamedRanges->addNewByName(aName4, aContent4, aBaseAddress, nType); + xNamedRanges->addNewByName(aName4, "D4", aBaseAddress, nType); CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type PRINT_AREA", xNamedRanges->hasByName(aName4)); nType = ::sheet::NamedRangeFlag::ROW_HEADER; - OUString const aContent5("D5"); OUString aName5("type_ROW_HEADER"); - xNamedRanges->addNewByName(aName5, aContent5, aBaseAddress, nType); + xNamedRanges->addNewByName(aName5, "D5", aBaseAddress, nType); CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type ROW_HEADER", xNamedRanges->hasByName(aName5)); } diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx index d67e871f0d69..5544d026d195 100644 --- a/test/source/sheet/xspreadsheets2.cxx +++ b/test/source/sheet/xspreadsheets2.cxx @@ -149,10 +149,8 @@ void XSpreadsheets2::testImportOverExistingNamedRange() uno::Reference< sheet::XNamedRange > xDestNamedRange(aNr, UNO_QUERY_THROW); OUString aNrDestContent = xDestNamedRange->getContent(); - OUString const aExpectedContent("$Sheet1.$B$1"); - std::cout << "testImportSheet : initial1 aNrDestContent " << aNrDestContent << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong address for initial1", aExpectedContent, aNrDestContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong address for initial1", OUString("$Sheet1.$B$1"), aNrDestContent); } @@ -197,9 +195,8 @@ void XSpreadsheets2::testImportNamedRangeRedefinedInSource() uno::Any aRedefinedInSheetNr = xDestNamedRangesNameAccess->getByName(aRedefinedInSheetNamedRangeString); uno::Reference< sheet::XNamedRange > xDestRedefinedInSheetNamedRange(aRedefinedInSheetNr, UNO_QUERY_THROW); OUString aRedefinedInSheetNrDestContent = xDestRedefinedInSheetNamedRange->getContent(); - OUString const aRedefinedInSheetExpectedContent("$Sheet1.$B$2"); std::cout << "testImportSheet : initial2 content " << aRedefinedInSheetNrDestContent << std::endl; - CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong address for Redefined InSheet named range", aRedefinedInSheetExpectedContent, aRedefinedInSheetNrDestContent); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong address for Redefined InSheet named range", OUString("$Sheet1.$B$2"), aRedefinedInSheetNrDestContent); } void XSpreadsheets2::testImportNewNamedRange() |