[Libreoffice-commits] core.git: Branch 'aoo/trunk' - shell/qa

Damjan Jovanovic damjan at apache.org
Sun Oct 4 23:08:03 PDT 2015


 shell/qa/zip/makefile.mk |   31 +++++++++++--------------------
 shell/qa/zip/ziptest.cxx |   45 ++++++++++++++++-----------------------------
 2 files changed, 27 insertions(+), 49 deletions(-)

New commits:
commit 0f6e2406f9263b9d99d9648c1f5d033b0d042fe0
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Mon Oct 5 04:20:14 2015 +0000

    #i125003# migrate main/shell tests from cppunit to Google Test

diff --git a/shell/qa/zip/makefile.mk b/shell/qa/zip/makefile.mk
index f1a0cee..fe3396c 100644
--- a/shell/qa/zip/makefile.mk
+++ b/shell/qa/zip/makefile.mk
@@ -30,32 +30,23 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  settings.mk
 
-.IF "$(WITH_CPPUNIT)" != "YES" || "$(GUI)" == "OS2"
-
- at all:
-.IF "$(GUI)" == "OS2"
-    @echo "Skipping, cppunit broken."
-.ELIF "$(WITH_CPPUNIT)" != "YES"
-    @echo "cppunit disabled. nothing do do."
-.END
-
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+    @echo unit tests are disabled. Nothing to do.
+ 
 .ELSE
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
 
-SHL1OBJS = $(SLOFILES)
-SHL1RPATH = NONE
-SHL1STDLIBS = $(SALLIB) $(CPPUNITLIB)  
-SHL1LIBS = $(SLB)$/..$/lib$/iqa_zipimpl.lib
-SHL1TARGET = $(TARGET)
-SHL1VERSIONMAP = $(PRJ)/qa/zip/export.map
-DEF1NAME=$(SHL1TARGET)
-SLOFILES=$(SLO)$/ziptest.obj  
+APP1OBJS = $(SLO)$/ziptest.obj
+APP1RPATH = NONE
+APP1STDLIBS = $(SALLIB) $(GTESTLIB)  
+APP1LIBS = $(SLB)$/..$/lib$/iqa_zipimpl.lib
+APP1TARGET = $(TARGET)
+APP1TEST = enabled
 
-.ENDIF
 
 # --- Targets ------------------------------------------------------
 
 .INCLUDE :  target.mk
-.INCLUDE: _cppunit.mk
 
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"
diff --git a/shell/qa/zip/ziptest.cxx b/shell/qa/zip/ziptest.cxx
index 5342675..75a4a8b 100644
--- a/shell/qa/zip/ziptest.cxx
+++ b/shell/qa/zip/ziptest.cxx
@@ -23,65 +23,52 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_shell.hxx"
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 #include <string>
 #include "testimpl/testzipimpl.hxx"
 using namespace std;
 
-class Test : public CppUnit::TestFixture
+class Test : public ::testing::Test
 {
-        private:
+        protected:
                 string documentName;
         public:
                 Test();
-                void setUp() {}
-                void tearDown() {}
-                void test_directory();
-                void test_hasContentCaseInSensitive();
-                void test_getContent();
-                CPPUNIT_TEST_SUITE(Test);
-                CPPUNIT_TEST(test_directory);
-                CPPUNIT_TEST(test_hasContentCaseInSensitive);
-                CPPUNIT_TEST(test_getContent);
-                CPPUNIT_TEST_SUITE_END();
+                void SetUp() {}
+                void TearDown() {}
 };
 
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
-
 Test::Test() :
         documentName("simpledocument.odt")
 {
 }
 
 //------------------------------------------------
-void Test::test_directory()
+TEST_F(Test, test_directory)
 {
         TestZipImpl testImpl(documentName.c_str());
         bool isPassed = testImpl.test_directory();
-        CPPUNIT_ASSERT_MESSAGE("Content does not match with expected directory names.", isPassed);
+        ASSERT_TRUE(isPassed) << "Content does not match with expected directory names.";
 }
 
 //------------------------------------------------
-void Test::test_hasContentCaseInSensitive()
+TEST_F(Test, test_hasContentCaseInSensitive)
 {
         TestZipImpl testImpl(documentName.c_str());
         bool isPassed = testImpl.test_hasContentCaseInSensitive();
-        CPPUNIT_ASSERT_MESSAGE("Content in zip file was not found.", isPassed);
+        ASSERT_TRUE(isPassed) << "Content in zip file was not found.";
 }
 
 //------------------------------------------------
-void Test::test_getContent()
+TEST_F(Test, test_getContent)
 {
         TestZipImpl testImpl(documentName.c_str());
         bool isPassed = testImpl.test_getContent();
-        CPPUNIT_ASSERT_MESSAGE("Couldn't receive content buffer form zipfile.", isPassed);
+        ASSERT_TRUE(isPassed) << "Couldn't receive content buffer form zipfile.";
 }
 
-//#####################################
-// register test suites
-
-CPPUNIT_PLUGIN_IMPLEMENT();
-
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}


More information about the Libreoffice-commits mailing list