diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-07-05 21:20:01 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-07-06 09:08:58 +0200 |
commit | 7aba05331b0e14d3ce2c811a4dc18d4714a7a575 (patch) | |
tree | b2b13a0ad2a9c8ff2954dd4e549277de160579bf /dbaccess | |
parent | 3f7cc820f9dcc215ea768da31f213c0e275baf04 (diff) |
DBTestBase: call close at tearDown
Otherwise, calling different tests one after the other
will fail with
warn:vcl:994718:994718:vcl/source/app/svmain.cxx:497: DeInitVCL: some top Windows are still alive
text = "lu9947181i0ytl.tmp — LibreOfficeDev Base" type = "10WorkWindow", ptr = 0x555b3ab76810
Change-Id: I6124b768e165ed841738d29c6071e7950b58229f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170058
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/qa/unit/dbtest_base.cxx | 15 | ||||
-rw-r--r-- | dbaccess/qa/unit/firebird.cxx | 10 |
2 files changed, 15 insertions, 10 deletions
diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx index 9c1dd32973eb..0208649906ad 100644 --- a/dbaccess/qa/unit/dbtest_base.cxx +++ b/dbaccess/qa/unit/dbtest_base.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbc/XDataSource.hpp> #include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/util/XCloseable.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -45,6 +46,8 @@ public: void createQueries(Reference< XDataSource > xDataSource); void createQuery(OUString sQuery, bool bEscapeProcessing, OUString sQueryName, Reference<XDataSource> xDataSource); + + virtual void tearDown() override; }; uno::Reference<XOfficeDatabaseDocument> DBTestBase::getDocumentForUrl(OUString const & url) { @@ -178,4 +181,16 @@ void DBTestBase::createQuery(OUString sQuery, bool bEscapeProcessing, OUString s xNameContainer->insertByName(sQueryName, Any(xQueryProp)); } +void DBTestBase::tearDown() +{ + if (mxComponent) + { + // In order to close all windows + css::uno::Reference<util::XCloseable> xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); + xCloseable->close(false); + } + + UnoApiTest::tearDown(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/qa/unit/firebird.cxx b/dbaccess/qa/unit/firebird.cxx index 089f152ee2d5..5f2f4077125e 100644 --- a/dbaccess/qa/unit/firebird.cxx +++ b/dbaccess/qa/unit/firebird.cxx @@ -15,7 +15,6 @@ #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XStatement.hpp> -#include <com/sun/star/util/XCloseable.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::sdb; @@ -48,9 +47,6 @@ void FirebirdTest::testEmptyDBConnection() getDocumentForUrl(maTempFile.GetURL()); getConnectionForDocument(xDocument); - - css::uno::Reference<util::XCloseable> xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); - xCloseable->close(false); } /** @@ -90,9 +86,6 @@ void FirebirdTest::testIntegerDatabase() xRow->getString(xColumnLocate->findColumn(u"_VARCHAR"_ustr))); CPPUNIT_ASSERT(!xResultSet->next()); // Should only be one row - - css::uno::Reference<util::XCloseable> xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); - xCloseable->close(false); } void FirebirdTest::testTdf132924() @@ -118,9 +111,6 @@ void FirebirdTest::testTdf132924() // - Actual : The column name 'TestId' is not valid CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xRow->getShort(xColumnLocate->findColumn(u"TestId"_ustr))); CPPUNIT_ASSERT_EQUAL(u"TestName"_ustr, xRow->getString(xColumnLocate->findColumn(u"TestName"_ustr))); - - css::uno::Reference<util::XCloseable> xCloseable(mxComponent, css::uno::UNO_QUERY_THROW); - xCloseable->close(false); } CPPUNIT_TEST_SUITE_REGISTRATION(FirebirdTest); |