sc/qa/unit/helper/qahelper.cxx | 28 ---------------------------- sc/qa/unit/helper/qahelper.hxx | 1 - sc/qa/unit/subsequent_export_test2.cxx | 17 ----------------- sc/qa/unit/uicalc/uicalc.cxx | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 46 deletions(-)
New commits: commit 8a542389d35ab8bde735b25d430e2e832bd418df Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Oct 27 09:57:41 2022 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Oct 27 11:29:28 2022 +0200 sc: move test to a better place it's not an export test. Besides, we can get rid of loadDocAndSetupModelViewController now Change-Id: Id6499ff8f0513453eb11eb0054cebd6423e9ae78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141899 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index be0fe4d2bcf6..45816c8f6fd4 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -665,34 +665,6 @@ ScDocShellRef ScBootstrapFixture::loadEmptyDocument(const uno::Sequence<beans::P return dynamic_cast<ScDocShell*>(pFoundShell); } -ScDocShellRef ScBootstrapFixture::loadDocAndSetupModelViewController(std::u16string_view rFileName, sal_Int32 nFormat) -{ - uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(comphelper::getProcessComponentContext()); - CPPUNIT_ASSERT(xDesktop.is()); - - // create a frame - Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame("_blank", 0); - CPPUNIT_ASSERT(xTargetFrame.is()); - - // 1. Open the document - ScDocShellRef xDocSh = loadDoc(rFileName, nFormat, true); - - uno::Reference< frame::XModel2 > xModel2 = xDocSh->GetModel(); - CPPUNIT_ASSERT(xModel2.is()); - - Reference< frame::XController2 > xController = xModel2->createDefaultViewController(xTargetFrame); - CPPUNIT_ASSERT(xController.is()); - - // introduce model/view/controller to each other - xController->attachModel(xModel2); - xModel2->connectController(xController); - xTargetFrame->setComponent(xController->getComponentWindow(), xController); - xController->attachFrame(xTargetFrame); - xModel2->setCurrentController(xController); - - return xDocSh; -} - ScDocShellRef ScBootstrapFixture::loadDoc( std::u16string_view rFileName, sal_Int32 nFormat, bool bReadWrite, bool bCheckErrorCode ) { diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 32447f716c02..5105bbdc73ba 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -203,7 +203,6 @@ protected: ScDocShellRef load(const OUString& rURL, sal_Int32 nFormat, bool bReadWrite = false); ScDocShellRef loadEmptyDocument(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rPropertyValues = {}); - ScDocShellRef loadDocAndSetupModelViewController(std::u16string_view rFileName, sal_Int32 nFormat); ScDocShellRef loadDoc( std::u16string_view rFileName, sal_Int32 nFormat, bool bReadWrite = false, bool bCheckErrorCode = true ); diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 5a54ac691f88..7c5edd4c1f4e 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -170,7 +170,6 @@ public: void testTdf84874(); void testTdf136721_paper_size(); void testTdf139258_rotated_image(); - void testTdf142854_GridVisibilityImportXlsxInHeadlessMode(); void testTdf144642_RowHeightRounding(); void testTdf145129_DefaultRowHeightRounding(); void testTdf140431(); @@ -295,7 +294,6 @@ public: CPPUNIT_TEST(testTdf84874); CPPUNIT_TEST(testTdf136721_paper_size); CPPUNIT_TEST(testTdf139258_rotated_image); - CPPUNIT_TEST(testTdf142854_GridVisibilityImportXlsxInHeadlessMode); CPPUNIT_TEST(testTdf144642_RowHeightRounding); CPPUNIT_TEST(testTdf145129_DefaultRowHeightRounding); CPPUNIT_TEST(testTdf140431); @@ -2516,21 +2514,6 @@ void ScExportTest2::testTdf139258_rotated_image() assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25"); } -void ScExportTest2::testTdf142854_GridVisibilityImportXlsxInHeadlessMode() -{ - // Tests are running in Headless mode - // Import an ods file with 'Hide' global grid visibility setting. - ScDocShellRef xShell - = loadDocAndSetupModelViewController(u"tdf126541_GridOffGlobally.", FORMAT_ODS); - CPPUNIT_ASSERT(!xShell->GetDocument().GetViewOptions().GetOption(VOPT_GRID)); - - // To avoid regression, in headless mode leave the bug tdf126541 - // It means Sheet based grid line visibility setting will overwrite the global setting. - // If there is only 1 sheet in the document, it will not result visible problems. - xShell = loadDocAndSetupModelViewController(u"tdf126541_GridOff.", FORMAT_XLSX); - CPPUNIT_ASSERT(!xShell->GetDocument().GetViewOptions().GetOption(VOPT_GRID)); -} - void ScExportTest2::testTdf144642_RowHeightRounding() { // MS Excel round down row heights to 0.75pt diff --git a/sc/qa/unit/data/xlsx/tdf126541_GridOff.xlsx b/sc/qa/unit/uicalc/data/tdf126541_GridOff.xlsx similarity index 100% rename from sc/qa/unit/data/xlsx/tdf126541_GridOff.xlsx rename to sc/qa/unit/uicalc/data/tdf126541_GridOff.xlsx diff --git a/sc/qa/unit/data/ods/tdf126541_GridOffGlobally.ods b/sc/qa/unit/uicalc/data/tdf126541_GridOffGlobally.ods similarity index 100% rename from sc/qa/unit/data/ods/tdf126541_GridOffGlobally.ods rename to sc/qa/unit/uicalc/data/tdf126541_GridOffGlobally.ods diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 38c8cb537371..93f0391b32e8 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -163,6 +163,24 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf100847) CPPUNIT_ASSERT(pDoc); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142854_GridVisibilityImportXlsxInHeadlessMode) +{ + // Tests are running in Headless mode + // Import an ods file with 'Hide' global grid visibility setting. + ScModelObj* pModelObj = createDoc("tdf126541_GridOffGlobally.ods"); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + CPPUNIT_ASSERT(!pDoc->GetViewOptions().GetOption(VOPT_GRID)); + + // To avoid regression, in headless mode leave the bug tdf126541 + // It means Sheet based grid line visibility setting will overwrite the global setting. + // If there is only 1 sheet in the document, it will not result visible problems. + pModelObj = createDoc("tdf126541_GridOff.xlsx"); + pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + CPPUNIT_ASSERT(!pDoc->GetViewOptions().GetOption(VOPT_GRID)); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences) { ScModelObj* pModelObj = createDoc();