[Libreoffice-commits] core.git: 2 commits - extras/source sw/qa

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 6 09:19:49 UTC 2020


 extras/source/palettes/standard.soh        |   29 ++++++++++++++-------
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |    3 +-
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx  |   16 +++++------
 sw/qa/extras/ooxmlexport/ooxmllinks.cxx    |    2 -
 sw/qa/extras/rtfexport/rtfexport2.cxx      |   18 ++++++++-----
 sw/qa/extras/rtfexport/rtfexport5.cxx      |    9 ++++--
 sw/qa/extras/ww8export/ww8export.cxx       |   16 +++++------
 sw/qa/inc/swmodeltestbase.hxx              |   40 +++++++++++++++++++++--------
 8 files changed, 86 insertions(+), 47 deletions(-)

New commits:
commit 191b43536a2bee034ef9902b49ca5fbcdbddec53
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 6 09:42:04 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Mar 6 10:19:20 2020 +0100

    SwModelTestBase: speed up export tests
    
    Export tests used to do the following steps:
    
    1) Import
    2) Verify
    3) Discard state
    4) Import
    5) Export
    6) Import
    7) Verify
    
    Assuming that the cost of 2), 3) and 7) is almost zero, that leaves us
    with 4 filter() invocations for every such "export" test. But it seems
    to me, we can save one filter() call if we do it this way:
    
    1) Import
    2) Verify
    3) Export
    4) Import
    5) Verify
    
    The only trick is that verify should perform its verification by only
    reading the document model. So adapt tests which mutated the doc model:
    paste tests should be import tests, the rest only did mutation by
    accident.
    
    A 'make check' is 88 seconds faster for me with this, using -j8. (~12
    minutes of CPU time saved.)
    
    Change-Id: I40db8a9b9adaa99020acd718ba4ec3fd9bee3fb8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90077
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 363584c78ea0..75403a4deeb9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1074,8 +1074,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95777, "tdf95777.docx")
     // This must not fail on open
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTdf94374, "hello.docx")
+CPPUNIT_TEST_FIXTURE(Test, testTdf94374)
 {
+    load(mpTestDocumentPath, "hello.docx");
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xText = xTextDocument->getText();
     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index 721f1292e8d5..a7f4b5e4eacf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -883,20 +883,20 @@ DECLARE_OOXMLEXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustmen
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
     CPPUNIT_ASSERT(pDoc);
 
-    SwPageDesc &Desc = pDoc->GetPageDesc( 0 );
-    drawing::TextVerticalAdjust nVA = Desc.GetVerticalAdjustment();
+    SwPageDesc* pDesc = &pDoc->GetPageDesc( 0 );
+    drawing::TextVerticalAdjust nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_CENTER, nVA );
 
-    Desc = pDoc->GetPageDesc( 1 );
-    nVA = Desc.GetVerticalAdjustment();
+    pDesc = &pDoc->GetPageDesc( 1 );
+    nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_TOP, nVA );
 
-    Desc = pDoc->GetPageDesc( 2 );
-    nVA = Desc.GetVerticalAdjustment();
+    pDesc = &pDoc->GetPageDesc( 2 );
+    nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BOTTOM, nVA );
 
-    Desc = pTextDoc->GetDocShell()->GetDoc()->GetPageDesc( 3 );
-    nVA = Desc.GetVerticalAdjustment();
+    pDesc = &pDoc->GetPageDesc( 3 );
+    nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BLOCK, nVA );
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
index d559242d505c..ba61d24e55c6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx
@@ -70,7 +70,7 @@
                 aOpt.SetSaveRelFSys(true);                                                         \
                 CPPUNIT_ASSERT(aOpt.IsSaveRelFSys());                                              \
             }                                                                                      \
-            executeImportExportImportTest(FileName);                                               \
+            executeLoadReloadVerify(FileName);                                               \
         }                                                                                          \
         void verify() override;                                                                    \
     };                                                                                             \
diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx
index ff63ac7db40f..243bf2511585 100644
--- a/sw/qa/extras/rtfexport/rtfexport2.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport2.cxx
@@ -599,8 +599,9 @@ DECLARE_RTFEXPORT_TEST(testFdo55493, "fdo55493.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width);
 }
 
-DECLARE_RTFEXPORT_TEST(testCopyPastePageStyle, "copypaste-pagestyle.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testCopyPastePageStyle)
 {
+    load(mpTestDocumentPath, "copypaste-pagestyle.rtf");
     // The problem was that RTF import during copy&paste did not ignore page styles.
     // Once we have more copy&paste tests, makes sense to refactor this to some helper method.
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
@@ -614,8 +615,9 @@ DECLARE_RTFEXPORT_TEST(testCopyPastePageStyle, "copypaste-pagestyle.rtf")
                          getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590
 }
 
-DECLARE_RTFEXPORT_TEST(testCopyPasteFootnote, "copypaste-footnote.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testCopyPasteFootnote)
 {
+    load(mpTestDocumentPath, "copypaste-footnote.rtf");
     // The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote.
     uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
@@ -625,8 +627,9 @@ DECLARE_RTFEXPORT_TEST(testCopyPasteFootnote, "copypaste-footnote.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString());
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo63428, "hello.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo63428)
 {
+    load(mpTestDocumentPath, "hello.rtf");
     // Pasting content that contained an annotation caused a crash.
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xText = xTextDocument->getText();
@@ -650,8 +653,9 @@ DECLARE_RTFEXPORT_TEST(testFdo69384, "fdo69384-paste.rtf")
     CPPUNIT_ASSERT_EQUAL(68.f, getProperty<float>(xPropertySet, "CharHeight"));
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo69384Inserted, "hello.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo69384Inserted)
 {
+    load(mpTestDocumentPath, "hello.rtf");
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xText = xTextDocument->getText();
     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
@@ -664,8 +668,9 @@ DECLARE_RTFEXPORT_TEST(testFdo69384Inserted, "hello.rtf")
     CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(xPropertySet, "CharHeight"));
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo61193, "hello.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo61193)
 {
+    load(mpTestDocumentPath, "hello.rtf");
     // Pasting content that contained a footnote caused a crash.
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xText = xTextDocument->getText();
@@ -673,8 +678,9 @@ DECLARE_RTFEXPORT_TEST(testFdo61193, "hello.rtf")
     paste("rtfexport/data/fdo61193.rtf", xEnd);
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf108123, "hello.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf108123)
 {
+    load(mpTestDocumentPath, "hello.rtf");
     // This crashed, the shape push/pop and table manager stack went out of
     // sync -> we tried to de-reference an empty stack.
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 24553a0c2538..bae656e26a70 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -112,8 +112,9 @@ DECLARE_RTFEXPORT_TEST(testFdo64671, "fdo64671.rtf")
     getRun(getParagraph(1), 1, OUString(u"\u017D"));
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo62044, "fdo62044.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo62044)
 {
+    load(mpTestDocumentPath, "fdo62044.rtf");
     // The problem was that RTF import during copy&paste did not ignore existing paragraph styles.
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xText = xTextDocument->getText();
@@ -815,8 +816,9 @@ DECLARE_RTFEXPORT_TEST(testTdf91074, "tdf91074.rtf")
                          getProperty<table::BorderLine2>(xShape, "TopBorder").Color);
 }
 
-DECLARE_RTFEXPORT_TEST(testTdf90260Nopar, "hello.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testTdf90260Nopar)
 {
+    load(mpTestDocumentPath, "hello.rtf");
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xText = xTextDocument->getText();
     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
@@ -956,8 +958,9 @@ DECLARE_RTFEXPORT_TEST(testTdf87034, "tdf87034.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString("A1B3C4D"), getParagraph(1)->getString());
 }
 
-DECLARE_RTFEXPORT_TEST(testClassificatonPasteLevels, "classification-confidential.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testClassificatonPasteLevels)
 {
+    load(mpTestDocumentPath, "classification-confidential.rtf");
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xText = xTextDocument->getText();
     uno::Reference<text::XTextRange> xEnd = xText->getEnd();
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 5b2499d231a4..bd83678eccae 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -1183,20 +1183,20 @@ DECLARE_WW8EXPORT_TEST(testTextVerticalAdjustment, "tdf36117_verticalAdjustment.
     SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
     CPPUNIT_ASSERT(pDoc);
 
-    SwPageDesc &Desc = pDoc->GetPageDesc( 0 );
-    drawing::TextVerticalAdjust nVA = Desc.GetVerticalAdjustment();
+    SwPageDesc* pDesc = &pDoc->GetPageDesc( 0 );
+    drawing::TextVerticalAdjust nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_CENTER, nVA );
 
-    Desc = pDoc->GetPageDesc( 1 );
-    nVA = Desc.GetVerticalAdjustment();
+    pDesc = &pDoc->GetPageDesc( 1 );
+    nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_TOP, nVA );
 
-    Desc = pDoc->GetPageDesc( 2 );
-    nVA = Desc.GetVerticalAdjustment();
+    pDesc = &pDoc->GetPageDesc( 2 );
+    nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BOTTOM, nVA );
 
-    Desc = pTextDoc->GetDocShell()->GetDoc()->GetPageDesc( 3 );
-    nVA = Desc.GetVerticalAdjustment();
+    pDesc = &pDoc->GetPageDesc( 3 );
+    nVA = pDesc->GetVerticalAdjustment();
     CPPUNIT_ASSERT_EQUAL( drawing::TextVerticalAdjust_BLOCK, nVA );
 }
 
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index f7738ef35eef..dcc7b6a146c1 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -68,15 +68,11 @@ using namespace css;
     virtual OUString getTestName() override { return #TestName; } \
         public:\
     CPPUNIT_TEST_SUITE(TestName); \
-    CPPUNIT_TEST(Import); \
-    CPPUNIT_TEST(Import_Export_Import); \
+    CPPUNIT_TEST(Load_Verify_Reload_Verify); \
     CPPUNIT_TEST_SUITE_END(); \
     \
-    void Import() { \
-        executeImportTest(filename, password);\
-    }\
-    void Import_Export_Import() {\
-        executeImportExportImportTest(filename, password);\
+    void Load_Verify_Reload_Verify() {\
+        executeLoadVerifyReloadVerify(filename, password);\
     }\
     void verify() override;\
     }; \
@@ -89,11 +85,11 @@ using namespace css;
     virtual OUString getTestName() override { return #TestName; } \
         public:\
     CPPUNIT_TEST_SUITE(TestName); \
-    CPPUNIT_TEST(Import_Export_Import); \
+    CPPUNIT_TEST(Load_Reload_Verify); \
     CPPUNIT_TEST_SUITE_END(); \
     \
-    void Import_Export_Import() {\
-        executeImportExportImportTest(filename, password);\
+    void Load_Reload_Verify() {\
+        executeLoadReloadVerify(filename, password);\
     }\
     void verify() override;\
     }; \
@@ -276,12 +272,34 @@ protected:
         }
     }
 
+    /**
+     * Helper func used by each unit test to test the 'export' code.
+     * (Loads the requested file, calls 'verify' function, save it to temp file, load the
+     * temp file and then calls 'verify' function again)
+     */
+    void executeLoadVerifyReloadVerify(const char* filename, const char* pPassword = nullptr)
+    {
+        maTempFile.EnableKillingFile(false);
+        header();
+        std::unique_ptr<Resetter> const pChanges(preTest(filename));
+        load(mpTestDocumentPath, filename, pPassword);
+        if (mustTestImportOf(filename))
+        {
+            verify();
+        }
+        postLoad(filename);
+        reload(mpFilter, filename, pPassword);
+        verify();
+        finish();
+        maTempFile.EnableKillingFile();
+    }
+
     /**
      * Helper func used by each unit test to test the 'export' code.
      * (Loads the requested file, save it to temp file, load the
      * temp file and then calls 'verify' method)
      */
-    void executeImportExportImportTest(const char* filename, const char* pPassword = nullptr)
+    void executeLoadReloadVerify(const char* filename, const char* pPassword = nullptr)
     {
         maTempFile.EnableKillingFile(false);
         header();
commit 30a6e9e991fd1b62ead2d393331a0364372c52fb
Author:     andreas kainz <kainz.a at gmail.com>
AuthorDate: Fri Mar 6 00:46:58 2020 +0100
Commit:     andreas_kainz <kainz.a at gmail.com>
CommitDate: Fri Mar 6 10:19:13 2020 +0100

    tdf#130928 Area Fill update hatcch section
    
    Change-Id: I3f2b04bdfaec66292ed454825dd261716571c61b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90073
    Tested-by: Jenkins
    Reviewed-by: andreas_kainz <kainz.a at gmail.com>

diff --git a/extras/source/palettes/standard.soh b/extras/source/palettes/standard.soh
index c3ba5806e374..536063792f6e 100644
--- a/extras/source/palettes/standard.soh
+++ b/extras/source/palettes/standard.soh
@@ -1,14 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <office:hatch-table xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style" xmlns:text="http://openoffice.org/2000/text" xmlns:table="http://openoffice.org/2000/table" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" xmlns:number="http://openoffice.org/2000/datastyle" xmlns:svg="http://www.w3.org/2000/svg" xmlns:chart="http://openoffice.org/2000/chart" xmlns:dr3d="http://openoffice.org/2000/dr3d" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="http://openoffice.org/2000/form" xmlns:script="http://openoffice.org/2000/script">
+    
  <draw:hatch draw:name="Black 0 Degrees" draw:style="single" draw:color="#000000" draw:distance="0.0402inch" draw:rotation="0"/>
- <draw:hatch draw:name="Black 45 Degrees" draw:style="single" draw:color="#000000" draw:distance="0.0402inch" draw:rotation="450"/>
- <draw:hatch draw:name="Black -45 Degrees" draw:style="single" draw:color="#000000" draw:distance="0.0402inch" draw:rotation="3150"/>
  <draw:hatch draw:name="Black 90 Degrees" draw:style="single" draw:color="#000000" draw:distance="0.0402inch" draw:rotation="900"/>
- <draw:hatch draw:name="Red Crossed 45 Degrees" draw:style="double" draw:color="#800000" draw:distance="0.0299inch" draw:rotation="450"/>
- <draw:hatch draw:name="Red Crossed 0 Degrees" draw:style="double" draw:color="#800000" draw:distance="0.0299inch" draw:rotation="900"/>
- <draw:hatch draw:name="Blue Crossed 45 Degrees" draw:style="double" draw:color="#000080" draw:distance="0.0299inch" draw:rotation="450"/>
- <draw:hatch draw:name="Blue Crossed 0 Degrees" draw:style="double" draw:color="#000080" draw:distance="0.0299inch" draw:rotation="900"/>
- <draw:hatch draw:name="Blue Triple 90 Degrees" draw:style="triple" draw:color="#0000ff" draw:distance="0.0402inch" draw:rotation="900"/>
- <draw:hatch draw:name="Black 45 Degrees Wide" draw:style="single" draw:color="#000000" draw:distance="0.2inch" draw:rotation="450"/>
-</office:hatch-table>
\ No newline at end of file
+ <draw:hatch draw:name="Black 180 Degrees Crossed" draw:style="double" draw:color="#000000" draw:distance="0.0402inch" draw:rotation="1800"/>
+ 
+ <draw:hatch draw:name="Blue 45 Degrees" draw:style="single" draw:color="#2a6099" draw:distance="0.0799inch" draw:rotation="450"/>
+ <draw:hatch draw:name="Blue -45 Degrees" draw:style="single" draw:color="#2a6099" draw:distance="0.0799inch" draw:rotation="3150"/>
+ <draw:hatch draw:name="Blue 45 Degrees Crossed" draw:style="double" draw:color="#2a6099" draw:distance="0.0799inch" draw:rotation="450"/>
+ 
+ <draw:hatch draw:name="Green 30 Degrees" draw:style="single" draw:color="#00a933" draw:distance="0.0799inch" draw:rotation="300"/>
+ <draw:hatch draw:name="Green 60 Degrees" draw:style="single" draw:color="#00a933" draw:distance="0.0799inch" draw:rotation="600"/>
+ <draw:hatch draw:name="Green 90 Degrees Triple" draw:style="triple" draw:color="#00a933" draw:distance="0.0799inch" draw:rotation="900"/>
+ 
+ <draw:hatch draw:name="Red 45 Degrees" draw:style="single" draw:color="#ff0000" draw:distance="0.1201inch" draw:rotation="450"/>
+ <draw:hatch draw:name="Red 90 Degrees Crossed" draw:style="double" draw:color="#ff0000" draw:distance="0.1201inch" draw:rotation="900"/>
+ <draw:hatch draw:name="Red -45 Degrees Triple" draw:style="triple" draw:color="#ff0000" draw:distance="0.1201inch" draw:rotation="1350"/>
+ 
+ <draw:hatch draw:name="Yellow 45 Degrees" draw:style="single" draw:color="#ffbf00" draw:distance="0.1614inch" draw:rotation="450"/>
+ <draw:hatch draw:name="Yellow 45 Degrees Crossed" draw:style="double" draw:color="#ffbf00" draw:distance="0.1614inch" draw:rotation="450"/>
+ <draw:hatch draw:name="Yellow 45 Degrees Triple" draw:style="triple" draw:color="#ffbf00" draw:distance="0.1614inch" draw:rotation="450"/>
+
+</office:hatch-table>


More information about the Libreoffice-commits mailing list