Author: damjan
Date: Sun Aug 30 08:41:13 2015
New Revision: 1700095

URL: http://svn.apache.org/r1700095
Log:
#i125003# migrate main/desktop from cppunit to Google Test


Added:
    openoffice/trunk/main/desktop/qa/deployment_misc/main.cxx
Modified:
    openoffice/trunk/main/desktop/qa/deployment_misc/makefile.mk
    openoffice/trunk/main/desktop/qa/deployment_misc/test_dp_version.cxx

Added: openoffice/trunk/main/desktop/qa/deployment_misc/main.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/desktop/qa/deployment_misc/main.cxx?rev=1700095&view=auto
==============================================================================
--- openoffice/trunk/main/desktop/qa/deployment_misc/main.cxx (added)
+++ openoffice/trunk/main/desktop/qa/deployment_misc/main.cxx Sun Aug 30 
08:41:13 2015
@@ -0,0 +1,28 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "gtest/gtest.h"
+
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}

Modified: openoffice/trunk/main/desktop/qa/deployment_misc/makefile.mk
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/desktop/qa/deployment_misc/makefile.mk?rev=1700095&r1=1700094&r2=1700095&view=diff
==============================================================================
--- openoffice/trunk/main/desktop/qa/deployment_misc/makefile.mk (original)
+++ openoffice/trunk/main/desktop/qa/deployment_misc/makefile.mk Sun Aug 30 
08:41:13 2015
@@ -20,18 +20,6 @@
 #**************************************************************
 
 
-
-.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
-
-.ENDIF "$(WITH_CPPUNIT)" != "YES" || "$(GUI)" == "OS2"
-
 PRJ := ..$/..
 PRJNAME := desktop
 .IF "$(GUI)" == "OS2"
@@ -45,7 +33,12 @@ ENABLE_EXCEPTIONS := TRUE
 .INCLUDE: settings.mk
 .INCLUDE: $(PRJ)$/source$/deployment$/inc$/dp_misc.mk
 
-CFLAGSCXX += $(CPPUNIT_CFLAGS)
+.IF "$(ENABLE_UNIT_TESTS)" != "YES"
+all:
+       @echo unit tests are disabled. Nothing to do.
+ 
+.ELSE
+
 
 # TODO:  On Windows, test_dp_version.cxx fails due to BOOL redefinition between
 # windef.h and tools/solar.h caused by including "precompiled_desktop.hxx"; 
this
@@ -53,15 +46,12 @@ CFLAGSCXX += $(CPPUNIT_CFLAGS)
 # 112600:
 CFLAGSCXX += -DDISABLE_PCH_HACK
 
-SHL1TARGET = $(TARGET)
-SHL1OBJS = $(SLO)$/test_dp_version.obj
-SHL1STDLIBS = $(CPPUNITLIB) $(DEPLOYMENTMISCLIB) $(SALLIB)
-SHL1VERSIONMAP = version.map
-SHL1RPATH = NONE
-SHL1IMPLIB = i$(SHL1TARGET)
-DEF1NAME = $(SHL1TARGET)
-
-SLOFILES = $(SHL1OBJS)
+APP1TARGET = $(TARGET)
+APP1OBJS = $(SLO)$/test_dp_version.obj $(SLO)$/main.obj
+APP1STDLIBS = $(GTESTLIB) $(DEPLOYMENTMISCLIB) $(SALLIB)
+APP1RPATH = NONE
+APP1TEST = enabled
 
 .INCLUDE: target.mk
-.INCLUDE : _cppunit.mk
+
+.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES"

Modified: openoffice/trunk/main/desktop/qa/deployment_misc/test_dp_version.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/desktop/qa/deployment_misc/test_dp_version.cxx?rev=1700095&r1=1700094&r2=1700095&view=diff
==============================================================================
--- openoffice/trunk/main/desktop/qa/deployment_misc/test_dp_version.cxx 
(original)
+++ openoffice/trunk/main/desktop/qa/deployment_misc/test_dp_version.cxx Sun 
Aug 30 08:41:13 2015
@@ -28,10 +28,7 @@
 
 #include <cstddef>
 
-#include "cppunit/TestAssert.h"
-#include "cppunit/TestFixture.h"
-#include "cppunit/extensions/HelperMacros.h"
-#include "cppunit/plugin/TestPlugIn.h"
+#include "gtest/gtest.h"
 #include "rtl/ustring.h"
 #include "rtl/ustring.hxx"
 
@@ -39,16 +36,11 @@
 
 namespace {
 
-class Test: public ::CppUnit::TestFixture {
+class Test: public ::testing::Test {
 public:
-    void test();
-
-    CPPUNIT_TEST_SUITE(Test);
-    CPPUNIT_TEST(test);
-    CPPUNIT_TEST_SUITE_END();
 };
 
-void Test::test() {
+TEST_F(Test, test) {
     struct Data {
         rtl::OUString version1;
         rtl::OUString version2;
@@ -70,20 +62,17 @@ void Test::test() {
           ::dp_misc::GREATER }
     };
     for (::std::size_t i = 0; i < sizeof data / sizeof (Data); ++i) {
-        CPPUNIT_ASSERT_EQUAL(
+        ASSERT_EQ(
             data[i].order,
             ::dp_misc::compareVersions(data[i].version1, data[i].version2));
         static ::dp_misc::Order const reverse[3] = {
             ::dp_misc::GREATER, ::dp_misc::EQUAL, ::dp_misc::LESS
         };
-        CPPUNIT_ASSERT_EQUAL(
+        ASSERT_EQ(
             reverse[data[i].order],
             ::dp_misc::compareVersions(data[i].version2, data[i].version1));
     }
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
-
-CPPUNIT_PLUGIN_IMPLEMENT();


Reply via email to