sc/qa/unit/helper/qahelper.cxx          |    5 ++++-
 sc/qa/unit/helper/qahelper.hxx          |    2 +-
 sc/qa/unit/subsequent_filters_test2.cxx |    5 +++--
 sw/qa/inc/swmodeltestbase.hxx           |    5 +++++
 sw/qa/unit/swmodeltestbase.cxx          |    9 +++++++--
 5 files changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 85fc28d328d7e53e6f263ac6d4ccbbf19d4db3c0
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Dec 1 11:30:45 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Dec 1 13:03:02 2022 +0100

    sw: check files are loaded without any warning error
    
    Change-Id: Ie48b33a93b7c2201c73418c625b63fdb2f1aec7a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143519
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 8b7775f1ae23..dda083f76539 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -330,6 +330,11 @@ protected:
      */
     SwDoc* getSwDoc();
 
+    /**
+     * Gets SwDocShell from loaded component
+     */
+    SwDocShell* getSwDocShell();
+
     /**
      * Wraps a reqif-xhtml fragment into an XHTML file, so an XML parser can
      * parse it.
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index a8dfc83493f9..05918c52397a 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -17,6 +17,7 @@
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 
 #include <comphelper/propertyvalue.hxx>
+#include <sfx2/docfile.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <unotools/streamwrap.hxx>
 #include <unotools/ucbstreamhelper.hxx>
@@ -447,6 +448,8 @@ void SwModelTestBase::loadURL(OUString const& rURL, const 
char* pName, const cha
 
     UnoApiXmlTest::load(rURL, pPassword);
 
+    CPPUNIT_ASSERT(!getSwDocShell()->GetMedium()->GetWarningError());
+
     discardDumpedLayout();
     if (pName && mustCalcLayoutOf(pName))
         calcLayout();
@@ -581,12 +584,14 @@ void SwModelTestBase::createSwGlobalDoc(const char* pName)
     
CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.GlobalDocument"));
 }
 
-SwDoc* SwModelTestBase::getSwDoc()
+SwDoc* SwModelTestBase::getSwDoc() { return getSwDocShell()->GetDoc(); }
+
+SwDocShell* SwModelTestBase::getSwDocShell()
 {
     SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
     CPPUNIT_ASSERT(pTextDoc);
 
-    return pTextDoc->GetDocShell()->GetDoc();
+    return pTextDoc->GetDocShell();
 }
 
 void SwModelTestBase::WrapReqifFromTempFile(SvMemoryStream& rStream)
commit 145dc0c5a00f7ee81cc839c2b506ecbe0f634ea7
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Dec 1 10:41:29 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Dec 1 13:02:47 2022 +0100

    sc: check files are loaded without any warning error
    
    Change-Id: I9163171d76e684835aff17d4777f8df88c848724
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143517
    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 336fd5754a29..dd1c6e09708c 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -469,7 +469,7 @@ void ScUcalcTestBase::tearDown()
     test::BootstrapFixture::tearDown();
 }
 
-void ScModelTestBase::createScDoc(const char* pName, const char* pPassword)
+void ScModelTestBase::createScDoc(const char* pName, const char* pPassword, 
bool bCheckWarningError)
 {
     if (!pName)
         load("private:factory/scalc");
@@ -478,6 +478,9 @@ void ScModelTestBase::createScDoc(const char* pName, const 
char* pPassword)
 
     uno::Reference<lang::XServiceInfo> xServiceInfo(mxComponent, 
uno::UNO_QUERY_THROW);
     
CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument"));
+
+    if (bCheckWarningError)
+        CPPUNIT_ASSERT(!getScDocShell()->GetMedium()->GetWarningError());
 }
 
 ScDocument* ScModelTestBase::getScDoc()
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index a8b48f938e01..80e7d53fae1f 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -154,7 +154,7 @@ public:
     {
     }
 
-    void createScDoc(const char* pName = nullptr, const char* pPassword = 
nullptr);
+    void createScDoc(const char* pName = nullptr, const char* pPassword = 
nullptr, bool bCheckErrorCode = true);
     ScDocument* getScDoc();
     ScDocShell* getScDocShell();
     ScTabViewShell* getViewShell();
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index e917d56ba836..d3744d33c86c 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -2880,7 +2880,7 @@ void ScFiltersTest2::testTooManyColsRows()
 {
     // The intentionally doc has cells beyond our MAXROW/MAXCOL, so there
     // should be a warning on load.
-    createScDoc("ods/too-many-cols-rows.ods");
+    createScDoc("ods/too-many-cols-rows.ods", /*pPassword*/ nullptr, 
/*bCheckWarningError*/ false);
 
     ScDocShell* pDocSh = getScDocShell();
     SfxMedium* pMedium = pDocSh->GetMedium();
@@ -2888,7 +2888,8 @@ void ScFiltersTest2::testTooManyColsRows()
     CPPUNIT_ASSERT(pMedium->GetWarningError() == SCWARN_IMPORT_ROW_OVERFLOW
                    || pMedium->GetWarningError() == 
SCWARN_IMPORT_COLUMN_OVERFLOW);
 
-    createScDoc("xlsx/too-many-cols-rows.xlsx");
+    createScDoc("xlsx/too-many-cols-rows.xlsx", /*pPassword*/ nullptr,
+                /*bCheckWarningError*/ false);
 
     pDocSh = getScDocShell();
     pMedium = pDocSh->GetMedium();

Reply via email to