[Libreoffice-commits] .: sw/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 21 13:09:26 PST 2012


 sw/qa/extras/inc/swmodeltestbase.hxx     |   35 +++++++++++++++++++++++++++++++
 sw/qa/extras/odfexport/odfexport.cxx     |   16 +++-----------
 sw/qa/extras/odfimport/odfimport.cxx     |    4 ++-
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   15 +++----------
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |    4 ++-
 sw/qa/extras/rtfexport/rtfexport.cxx     |   14 +++---------
 sw/qa/extras/rtfimport/rtfimport.cxx     |    4 ++-
 sw/qa/extras/ww8export/ww8export.cxx     |   15 +++----------
 sw/qa/extras/ww8import/ww8import.cxx     |    4 ++-
 9 files changed, 63 insertions(+), 48 deletions(-)

New commits:
commit 60c01fe42f90876f9a636780aa3b23ccf6a1398b
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Dec 21 22:07:47 2012 +0100

    sw: add csv output for extra filter tests
    
    Like the minimal filter tests, these tests are invoked from a single
    cppunit method since commit 0a30cb22a141c26b4eab43a478d32df0769596ec, so
    some info about exactly what file failed is necessary. If we are at it,
    also print the (re)loading time as well.

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 378dc15..7b4ad3d 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -35,6 +35,7 @@
 #include <unotest/macros_test.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <comphelper/processfactory.hxx>
+#include <unotools/tempfile.hxx>
 
 #include <unotxdoc.hxx>
 #include <docsh.hxx>
@@ -227,6 +228,39 @@ protected:
         return getProperty<OUString>(getProperty< uno::Reference<beans::XPropertySet> >(xFormula, "Model"), "Formula");
     }
 
+    void header()
+    {
+        fprintf(stderr, "File tested,Execution Time (ms)\n");
+    }
+
+    void load(const char* pDir, const char* pName)
+    {
+        // Output name early, so in the case of a hang, the name of the hanging input file is visible.
+        fprintf(stderr, "%s,", pName);
+        m_nStartTime = osl_getGlobalTimer();
+        mxComponent = loadFromDesktop(getURLFromSrc(pDir) + OUString::createFromAscii(pName));
+    }
+    
+    void reload(OUString aFilter)
+    {
+        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+        uno::Sequence<beans::PropertyValue> aArgs(1);
+        aArgs[0].Name = "FilterName";
+        aArgs[0].Value <<= aFilter;
+        utl::TempFile aTempFile;
+        aTempFile.EnableKillingFile();
+        xStorable->storeToURL(aTempFile.GetURL(), aArgs);
+        uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
+        xComponent->dispose();
+        mxComponent = loadFromDesktop(aTempFile.GetURL());
+    }
+
+    void finish()
+    {
+        sal_uInt32 nEndTime = osl_getGlobalTimer();
+        fprintf(stderr, "%" SAL_PRIuUINT32"\n", nEndTime - m_nStartTime);
+    }
+
     uno::Reference<lang::XComponent> mxComponent;
     xmlBufferPtr mpXmlBuffer;
 
@@ -236,6 +270,7 @@ protected:
         const char* pName;
         void (T::*pMethod)();
     };
+    sal_uInt32 m_nStartTime;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 7d93b3b..92c934c 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -25,7 +25,6 @@
  * instead of those above.
  */
 
-#include <unotools/tempfile.hxx>
 #include <swmodeltestbase.hxx>
 
 class Test : public SwModelTestBase
@@ -50,24 +49,17 @@ void Test::run()
         {"fdo38244.odt", &Test::testFdo38244},
         {"first-header-footer.odt", &Test::testFirstHeaderFooter},
     };
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfexport/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/odfexport/data/", rEntry.pName);
         // If the testcase is stored in some other format, it's pointless to test.
         if (OString(rEntry.pName).endsWith(".odt"))
             (this->*rEntry.pMethod)();
-        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-        uno::Sequence<beans::PropertyValue> aArgs(1);
-        aArgs[0].Name = "FilterName";
-        aArgs[0].Value <<= OUString("writer8");
-        utl::TempFile aTempFile;
-        aTempFile.EnableKillingFile();
-        xStorable->storeToURL(aTempFile.GetURL(), aArgs);
-        uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
-        xComponent->dispose();
-        mxComponent = loadFromDesktop(aTempFile.GetURL());
+        reload("writer8");
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 885413c..fff0e79 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -62,11 +62,13 @@ void Test::run()
         {"hello.odt", &Test::testPageStyleLayoutDefault},
         {"hello.odt", &Test::testPageStyleLayoutRight},
     };
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfimport/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/odfimport/data/",  rEntry.pName);
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index e578be8..0f99cf5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -111,24 +111,17 @@ void Test::run()
         "math-mso2k7.docx",
     };
     std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ooxmlexport/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/ooxmlexport/data/", rEntry.pName);
         // If the testcase is stored in some other format, it's pointless to test.
         if (OString(rEntry.pName).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), rEntry.pName) == vBlacklist.end())
             (this->*rEntry.pMethod)();
-        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-        uno::Sequence<beans::PropertyValue> aArgs(1);
-        aArgs[0].Name = "FilterName";
-        aArgs[0].Value <<= OUString("Office Open XML Text");
-        utl::TempFile aTempFile;
-        aTempFile.EnableKillingFile();
-        xStorable->storeToURL(aTempFile.GetURL(), aArgs);
-        uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
-        xComponent->dispose();
-        mxComponent = loadFromDesktop(aTempFile.GetURL());
+        reload("Office Open XML Text");
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 5778f37..3b7a658 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -175,11 +175,13 @@ void Test::run()
         {"tableborder-finedash.docx", &Test::testFineTableDash},
         {"n792778.docx", &Test::testN792778},
     };
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ooxmlimport/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/ooxmlimport/data/",  rEntry.pName);
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 150fc61..4a4e622 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -33,7 +33,6 @@
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
 
-#include <unotools/tempfile.hxx>
 #include <vcl/svapp.hxx>
 #include <swmodeltestbase.hxx>
 
@@ -125,22 +124,17 @@ void Test::run()
         "math-runs.rtf",
     };
     std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/rtfexport/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/rtfexport/data/", rEntry.pName);
         // If the testcase is stored in some other format, it's pointless to test.
         if (OString(rEntry.pName).endsWith(".rtf") && std::find(vBlacklist.begin(), vBlacklist.end(), rEntry.pName) == vBlacklist.end())
             (this->*rEntry.pMethod)();
-        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-        uno::Sequence<beans::PropertyValue> aArgs(1);
-        aArgs[0].Name = "FilterName";
-        aArgs[0].Value <<= OUString("Rich Text Format");
-        utl::TempFile aTempFile;
-        aTempFile.EnableKillingFile();
-        xStorable->storeToURL(aTempFile.GetURL(), aArgs);
-        mxComponent = loadFromDesktop(aTempFile.GetURL());
+        reload("Rich Text Format");
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 2df2e05..dce1b90 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -209,6 +209,7 @@ void Test::run()
         {"fdo54473.rtf", &Test::testFdo54473},
         {"fdo49934.rtf", &Test::testFdo49934},
     };
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
@@ -225,10 +226,11 @@ void Test::run()
             aSettings.SetLanguageTag(LanguageTag("lt"));
             Application::SetSettings(aSettings);
         }
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/rtfimport/data/", rEntry.pName);
         if (OString(rEntry.pName) == "fdo48023.rtf" || OString(rEntry.pName) == "fdo44211.rtf")
             Application::SetSettings(aSavedSettings);
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 679f765..963bf75 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -31,8 +31,6 @@
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
-#include <unotools/tempfile.hxx>
-
 #include <swmodeltestbase.hxx>
 
 class Test : public SwModelTestBase
@@ -61,22 +59,17 @@ void Test::run()
         {"fdo46020.odt", &Test::testFdo46020},
         {"first-header-footer.doc", &Test::testFirstHeaderFooter},
     };
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ww8export/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/ww8export/data/", rEntry.pName);
         // If the testcase is stored in some other format, it's pointless to test.
         if (OString(rEntry.pName).endsWith(".doc"))
             (this->*rEntry.pMethod)();
-        uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
-        uno::Sequence<beans::PropertyValue> aArgs(1);
-        aArgs[0].Name = "FilterName";
-        aArgs[0].Value <<= OUString("MS Word 97");
-        utl::TempFile aTempFile;
-        aTempFile.EnableKillingFile();
-        xStorable->storeToURL(aTempFile.GetURL(), aArgs);
-        mxComponent = loadFromDesktop(aTempFile.GetURL());
+        reload("MS Word 97");
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index b47e525..d650e11 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -69,11 +69,13 @@ void Test::run()
         {"n757905.doc", &Test::testN757905},
         {"all_gaps_word.doc", &Test::testAllGapsWord},
     };
+    header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
         MethodEntry<Test>& rEntry = aMethods[i];
-        mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ww8import/data/") + OUString::createFromAscii(rEntry.pName));
+        load("/sw/qa/extras/ww8import/data/", rEntry.pName);
         (this->*rEntry.pMethod)();
+        finish();
     }
 }
 


More information about the Libreoffice-commits mailing list