summaryrefslogtreecommitdiff
path: root/test/source/sheet/xspreadsheets2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'test/source/sheet/xspreadsheets2.cxx')
-rw-r--r--test/source/sheet/xspreadsheets2.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx
index 9c53af7374fb..dd0fbbace5ac 100644
--- a/test/source/sheet/xspreadsheets2.cxx
+++ b/test/source/sheet/xspreadsheets2.cxx
@@ -26,15 +26,16 @@
#include <rtl/ustring.hxx>
#include <cppunit/TestAssert.h>
+#include <o3tl/string_view.hxx>
using namespace css;
using namespace css::uno;
namespace apitest {
-constexpr OUStringLiteral gaSrcSheetName(u"SheetToCopy");
+constexpr OUString gaSrcSheetName(u"SheetToCopy"_ustr);
constexpr OUStringLiteral gaSrcFileName(u"rangenamessrc.ods");
-constexpr OUStringLiteral gaDestFileBase(u"ScNamedRangeObj.ods");
+constexpr OUString gaDestFileBase(u"ScNamedRangeObj.ods"_ustr);
static sal_Int32 nInsertedSheets(0);
@@ -242,7 +243,7 @@ void XSpreadsheets2::testImportCellStyle()
//new style created in dest
uno::Reference< beans::XPropertySet > xSrcCellPropSet (xSrcCell, UNO_QUERY_THROW);
- const OUString aCellProperty("CellStyle");
+ static constexpr OUString aCellProperty(u"CellStyle"_ustr);
OUString aSrcStyleName;
CPPUNIT_ASSERT(xSrcCellPropSet->getPropertyValue(aCellProperty) >>= aSrcStyleName);
@@ -319,13 +320,7 @@ void XSpreadsheets2::testLastAfterInsertCopy()
uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUString& aFileBase)
{
- OUString aFileURL;
- createFileURL(aFileBase, aFileURL);
-
- uno::Reference< lang::XComponent > xComp = loadFromDesktop(aFileURL);
-
- CPPUNIT_ASSERT(xComp.is());
-
+ uno::Reference< lang::XComponent > xComp = loadFromDesktop(aFileBase);
uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComp, UNO_QUERY_THROW);
return xDoc;
}
@@ -356,12 +351,14 @@ void XSpreadsheets2::importSheetToCopy()
xDestSheet.set( xDestSheetIndexAccess->getByIndex(nDestPosEffective), UNO_QUERY_THROW);
}
-bool XSpreadsheets2::isExternalReference(const OUString& aDestContent, std::u16string_view aSrcContent )
+bool XSpreadsheets2::isExternalReference(std::u16string_view aDestContent, std::u16string_view aSrcContent )
{
- CPPUNIT_ASSERT(aDestContent.startsWith("'file://"));
+ CPPUNIT_ASSERT(o3tl::starts_with(aDestContent, u"'file://"));
- return (aDestContent.endsWithIgnoreAsciiCase(aSrcContent) // same cell address
- && aDestContent.indexOf(gaSrcFileName)>0); // contains source file name
+ if (!o3tl::endsWithIgnoreAsciiCase(aDestContent, aSrcContent)) // same cell address
+ return false;
+ size_t nPos = aDestContent.find(gaSrcFileName);
+ return nPos != std::u16string_view::npos && nPos > 0; // contains source file name
}
}