diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-23 11:51:57 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-23 14:43:56 +0100 |
commit | 6c3cebd5aaec641807f5efed814fc5d1c64df149 (patch) | |
tree | dc5333838c1a973afc5b72190e0be28dfcdc6e76 /dbaccess | |
parent | 139d1aa610d19ab200deff1e3cd2c787f5c87d89 (diff) |
UnoApiTest: factor out createTempFile
Change-Id: I8d7bb4593839d3660b6609d836b09d50b68f5712
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143141
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/qa/unit/dbtest_base.cxx | 16 | ||||
-rw-r--r-- | dbaccess/qa/unit/firebird.cxx | 4 | ||||
-rw-r--r-- | dbaccess/qa/unit/hsql_binary_import.cxx | 5 | ||||
-rw-r--r-- | dbaccess/qa/unit/hsqldb.cxx | 4 | ||||
-rw-r--r-- | dbaccess/qa/unit/tdf119625.cxx | 5 | ||||
-rw-r--r-- | dbaccess/qa/unit/tdf126268.cxx | 5 |
6 files changed, 13 insertions, 26 deletions
diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx index 8e7d2ab433c9..88da4b469742 100644 --- a/dbaccess/qa/unit/dbtest_base.cxx +++ b/dbaccess/qa/unit/dbtest_base.cxx @@ -30,8 +30,6 @@ class DBTestBase public: DBTestBase() : UnoApiTest("dbaccess/qa/unit/data") {}; - utl::TempFileNamed createTempCopy(std::u16string_view pathname); - uno::Reference<XOfficeDatabaseDocument> getDocumentForUrl(OUString const & url); uno::Reference< XConnection > @@ -39,20 +37,6 @@ public: uno::Reference< XOfficeDatabaseDocument > const & xDocument); }; -utl::TempFileNamed DBTestBase::createTempCopy(std::u16string_view pathname) { - OUString url = createFileURL(pathname); - utl::TempFileNamed tmp; - tmp.EnableKillingFile(); - auto const e = osl::File::copy(url, tmp.GetURL()); - CPPUNIT_ASSERT_EQUAL_MESSAGE( - (OString( - "<" + OUStringToOString(url, RTL_TEXTENCODING_UTF8) + "> -> <" - + OUStringToOString(tmp.GetURL(), RTL_TEXTENCODING_UTF8) + ">") - .getStr()), - osl::FileBase::E_None, e); - return tmp; -} - uno::Reference<XOfficeDatabaseDocument> DBTestBase::getDocumentForUrl(OUString const & url) { mxComponent = loadFromDesktop(url); uno::Reference< XOfficeDatabaseDocument > xDocument(mxComponent, UNO_QUERY_THROW); diff --git a/dbaccess/qa/unit/firebird.cxx b/dbaccess/qa/unit/firebird.cxx index 076144e1b054..8eaf39430e96 100644 --- a/dbaccess/qa/unit/firebird.cxx +++ b/dbaccess/qa/unit/firebird.cxx @@ -43,9 +43,9 @@ public: */ void FirebirdTest::testEmptyDBConnection() { - auto const tmp = createTempCopy(u"firebird_empty.odb"); + createTempCopy(u"firebird_empty.odb"); uno::Reference< XOfficeDatabaseDocument > xDocument = - getDocumentForUrl(tmp.GetURL()); + getDocumentForUrl(maTempFile.GetURL()); getConnectionForDocument(xDocument); diff --git a/dbaccess/qa/unit/hsql_binary_import.cxx b/dbaccess/qa/unit/hsql_binary_import.cxx index fb9185a82b4c..569463e7e4ef 100644 --- a/dbaccess/qa/unit/hsql_binary_import.cxx +++ b/dbaccess/qa/unit/hsql_binary_import.cxx @@ -46,8 +46,9 @@ void HsqlBinaryImportTest::testBinaryImport() } // the migration requires the file to be writable - utl::TempFileNamed const temp(createTempCopy(u"hsqldb_migration_test.odb")); - uno::Reference<XOfficeDatabaseDocument> const xDocument = getDocumentForUrl(temp.GetURL()); + createTempCopy(u"hsqldb_migration_test.odb"); + uno::Reference<XOfficeDatabaseDocument> const xDocument + = getDocumentForUrl(maTempFile.GetURL()); uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument); // at this point migration is already done diff --git a/dbaccess/qa/unit/hsqldb.cxx b/dbaccess/qa/unit/hsqldb.cxx index 7d792b3c26a8..eb553eac756e 100644 --- a/dbaccess/qa/unit/hsqldb.cxx +++ b/dbaccess/qa/unit/hsqldb.cxx @@ -32,8 +32,8 @@ public: */ void HSQLDBTest::testEmptyDBConnection() { - auto const file = createTempCopy(u"hsqldb_empty.odb"); - uno::Reference<XOfficeDatabaseDocument> xDocument = getDocumentForUrl(file.GetURL()); + createTempCopy(u"hsqldb_empty.odb"); + uno::Reference<XOfficeDatabaseDocument> xDocument = getDocumentForUrl(maTempFile.GetURL()); getConnectionForDocument(xDocument); } diff --git a/dbaccess/qa/unit/tdf119625.cxx b/dbaccess/qa/unit/tdf119625.cxx index 7486f9f44fe2..ba0c7b2ce345 100644 --- a/dbaccess/qa/unit/tdf119625.cxx +++ b/dbaccess/qa/unit/tdf119625.cxx @@ -66,8 +66,9 @@ void Tdf119625Test::testTime() } // the migration requires the file to be writable - utl::TempFileNamed const temp(createTempCopy(u"tdf119625.odb")); - uno::Reference<XOfficeDatabaseDocument> const xDocument = getDocumentForUrl(temp.GetURL()); + createTempCopy(u"tdf119625.odb"); + uno::Reference<XOfficeDatabaseDocument> const xDocument + = getDocumentForUrl(maTempFile.GetURL()); uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument); // at this point migration is already done diff --git a/dbaccess/qa/unit/tdf126268.cxx b/dbaccess/qa/unit/tdf126268.cxx index c565648b6150..c06fdead79c7 100644 --- a/dbaccess/qa/unit/tdf126268.cxx +++ b/dbaccess/qa/unit/tdf126268.cxx @@ -60,8 +60,9 @@ void Tdf126268Test::testNumbers() } // the migration requires the file to be writable - utl::TempFileNamed const temp(createTempCopy(u"tdf126268.odb")); - uno::Reference<XOfficeDatabaseDocument> const xDocument = getDocumentForUrl(temp.GetURL()); + createTempCopy(u"tdf126268.odb"); + uno::Reference<XOfficeDatabaseDocument> const xDocument + = getDocumentForUrl(maTempFile.GetURL()); uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument); |