[QGIS Commit] r9398 - in trunk/external_plugins/cdp2: . src src/tests

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Sep 24 04:21:23 EDT 2008


Author: timlinux
Date: 2008-09-24 04:21:23 -0400 (Wed, 24 Sep 2008)
New Revision: 9398

Added:
   trunk/external_plugins/cdp2/src/tests/
   trunk/external_plugins/cdp2/src/tests/CMakeLists.txt
   trunk/external_plugins/cdp2/src/tests/cdptest.cpp
   trunk/external_plugins/cdp2/src/tests/test_data/
Modified:
   trunk/external_plugins/cdp2/CMakeLists.txt
   trunk/external_plugins/cdp2/src/CMakeLists.txt
Log:
Added simple test framework and use rpath for lib location

Modified: trunk/external_plugins/cdp2/CMakeLists.txt
===================================================================
--- trunk/external_plugins/cdp2/CMakeLists.txt	2008-09-24 01:23:24 UTC (rev 9397)
+++ trunk/external_plugins/cdp2/CMakeLists.txt	2008-09-24 08:21:23 UTC (rev 9398)
@@ -63,14 +63,31 @@
     )
 
 #############################################################
+# Enable the use of RPATH so that the executeable
+# library search paths are relative to the executeable
+#
+
+# use, i.e. don't skip the full RPATH for the build tree
+SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
+
+# when building, don't use the install RPATH already
+# (but later on when installing)
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
+
+# the RPATH to be used when installing
+SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+
+# add the automatically determined parts of the RPATH
+# which point to directories outside the build tree to the install RPATH
+SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+
+#############################################################
 # enable warnings, halt compile on warnings
 IF (PEDANTIC AND NOT MSVC)
   ADD_DEFINITIONS( -Wall -Werror )
 ENDIF (PEDANTIC AND NOT MSVC)
 
-IF (CMAKE_BUILD_TYPE MATCHES Debug)
-  ADD_DEFINITIONS(-DCDP_NO_EXPERIMENTAL)
-ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
 
 
 #############################################################

Modified: trunk/external_plugins/cdp2/src/CMakeLists.txt
===================================================================
--- trunk/external_plugins/cdp2/src/CMakeLists.txt	2008-09-24 01:23:24 UTC (rev 9397)
+++ trunk/external_plugins/cdp2/src/CMakeLists.txt	2008-09-24 08:21:23 UTC (rev 9398)
@@ -5,6 +5,6 @@
 #  SUBDIRS(mac)
 #ENDIF(APPLE)
 
-#IF (ENABLE_TESTS)
-#  SUBDIRS(tests)
-#ENDIF (ENABLE_TESTS)
+IF (ENABLE_TESTS)
+  SUBDIRS(tests)
+ENDIF (ENABLE_TESTS)

Added: trunk/external_plugins/cdp2/src/tests/CMakeLists.txt
===================================================================
--- trunk/external_plugins/cdp2/src/tests/CMakeLists.txt	                        (rev 0)
+++ trunk/external_plugins/cdp2/src/tests/CMakeLists.txt	2008-09-24 08:21:23 UTC (rev 9398)
@@ -0,0 +1,75 @@
+SET( QT_USE_QTTEST     TRUE )
+#####################################################
+# Don't forget to include output directory, otherwise
+# the UI file won't be wrapped!
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} 
+# binary make output dirs for uics and mocs
+  ${CMAKE_CURRENT_BINARY_DIR}
+  ${CMAKE_CURRENT_BINARY_DIR}/../../
+  ${CMAKE_CURRENT_BINARY_DIR}/../ui
+# source dirs
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../
+  ${CMAKE_CURRENT_SOURCE_DIR}/../lib
+  ${CMAKE_CURRENT_SOURCE_DIR}/../gui
+  ${QT_INCLUDE_DIR}
+  ${GDAL_INCLUDE_DIR}
+  )
+
+#MESSAGE("Test Data Dir: ${TEST_DATA_DIR}")
+ADD_DEFINITIONS(-DTEST_DATA_DIR="\\"${TEST_DATA_DIR}\\"")
+
+#############################################################
+# libraries
+
+# because of htonl
+IF (WIN32)
+  SET(PLATFORM_LIBRARIES wsock32)
+ENDIF (WIN32)
+
+# Since the tests are not actually installed, but rather
+# run directly from the build/src/tests dir we need to
+# ensure the omg libs can be found.
+IF (APPLE)
+  # For Mac OS X, the executable must be at the root of the bundle's executable folder
+  SET (CMAKE_INSTALL_NAME_DIR @executable_path/../lib)
+ENDIF (APPLE)
+
+
+SET (REQUIRED_LIBS 
+      ${QT_QTCORE_LIBRARY} 
+      ${QT_QTTEST_LIBRARY} 
+      ${QT_QTGUI_LIBRARY} 
+      ${QT_QTXML_LIBRARY} 
+      ${QT_QTSVG_LIBRARY} 
+      ${QT_QTNETWORK_LIBRARY} 
+      ${QT_QTMAIN_LIBRARY} 
+      cdp_core
+    ) 
+#note for tests we should not include the moc of our
+#qtests in the executable file list as the moc is
+#directly included in the sources
+#and should not be compiled twice. Trying to include
+#them in will cause an error at build time 
+
+#############################################################
+# sources
+# cdp test
+SET(CDPTEST_SRCS cdptest.cpp)
+SET(CDPTEST_MOC_CPPS cdptest.cpp)
+QT4_WRAP_CPP(CDPTEST_MOC_SRCS ${CDPTEST_MOC_CPPS})
+ADD_CUSTOM_TARGET(cdptestmoc ALL DEPENDS ${CDPTEST_MOC_SRCS})
+ADD_EXECUTABLE(cdptest ${CDPTEST_SRCS})
+ADD_DEPENDENCIES(cdptest cdptestmoc)
+TARGET_LINK_LIBRARIES(cdptest ${REQUIRED_LIBS})
+INSTALL(TARGETS cdptest RUNTIME DESTINATION ${CDP_TEST_DIR})
+ADD_TEST(cdp ${CDP_TEST_DIR}/cdptest)
+
+# Put the libs needed into the test dir
+#MESSAGE ("Current Binary Dir: ${CMAKE_CURRENT_BINARY_DIR}")
+IF (WIN32)
+  INSTALL (FILES ${CMAKE_INSTALL_PREFIX}/cdp_core.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ENDIF (WIN32)
+
+IF (APPLE)
+  INSTALL (FILES ${CMAKE_BINARY_DIR}/src/lib/libcdp_core.dylib DESTINATION ${CDP_TEST_DIR}/lib/)
+ENDIF (APPLE)

Added: trunk/external_plugins/cdp2/src/tests/cdptest.cpp
===================================================================
--- trunk/external_plugins/cdp2/src/tests/cdptest.cpp	                        (rev 0)
+++ trunk/external_plugins/cdp2/src/tests/cdptest.cpp	2008-09-24 08:21:23 UTC (rev 9398)
@@ -0,0 +1,57 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by Tim Sutton   *
+ *   tim at linfiniti.com   *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+#include <QtTest/QtTest>
+#include <climatedataprocessorcontroller.h>
+#include <QImage>
+#include <QList>
+
+class CdpTest: public QObject
+{
+  Q_OBJECT;
+  private slots:
+  /** Regression test for making sure 
+      available calcs always computes correctly grid layers */
+  void availableCalcsTest(); 
+  void initTestCase();// will be called before the first testfunction is executed.
+  void cleanupTestCase();// will be called after the last testfunction was executed.
+  void init(){};// will be called before each testfunction is executed.
+  void cleanup(){};// will be called after every testfunction.
+  private:
+  //add private test vars here
+};
+
+void CdpTest::initTestCase()
+{
+  QCoreApplication::setOrganizationName("Linfiniti Consulting");
+  QCoreApplication::setOrganizationDomain("linfiniti.com");
+  QCoreApplication::setApplicationName("ClimateDataProcessor");
+}
+void CdpTest::cleanupTestCase()
+{
+}
+void CdpTest::availableCalcsTest()
+{
+}
+
+QTEST_MAIN(CdpTest) 
+#include "moc_cdptest.cxx"
+  
+
+



More information about the QGIS-commit mailing list