You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2015/10/05 06:20:14 UTC

svn commit: r1706747 - in /openoffice/trunk/main/shell/qa/zip: makefile.mk ziptest.cxx

Author: damjan
Date: Mon Oct  5 04:20:14 2015
New Revision: 1706747

URL: http://svn.apache.org/viewvc?rev=1706747&view=rev
Log:
#i125003# migrate main/shell tests from cppunit to Google Test


Modified:
    openoffice/trunk/main/shell/qa/zip/makefile.mk
    openoffice/trunk/main/shell/qa/zip/ziptest.cxx

Modified: openoffice/trunk/main/shell/qa/zip/makefile.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/shell/qa/zip/makefile.mk?rev=1706747&r1=1706746&r2=1706747&view=diff
==============================================================================
--- openoffice/trunk/main/shell/qa/zip/makefile.mk (original)
+++ openoffice/trunk/main/shell/qa/zip/makefile.mk Mon Oct  5 04:20:14 2015
@@ -30,32 +30,23 @@ ENABLE_EXCEPTIONS=TRUE
 
 .INCLUDE :  settings.mk
 
-.IF "$(WITH_CPPUNIT)" != "YES" || "$(GUI)" == "OS2"
-
-@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"

Modified: openoffice/trunk/main/shell/qa/zip/ziptest.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/shell/qa/zip/ziptest.cxx?rev=1706747&r1=1706746&r2=1706747&view=diff
==============================================================================
--- openoffice/trunk/main/shell/qa/zip/ziptest.cxx (original)
+++ openoffice/trunk/main/shell/qa/zip/ziptest.cxx Mon Oct  5 04:20:14 2015
@@ -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();
+}