[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [cantor/frameworks] src: reenable and fix unit tests for the octave backend
From:       Alexander Rieder <alexanderrieder () gmail ! com>
Date:       2014-11-11 18:25:22
Message-ID: E1XoG82-0005IH-6H () scm ! kde ! org
[Download RAW message or body]

Git commit eb7f3432e49c3f1573c24aa3b40657a45c4631eb by Alexander Rieder.
Committed on 11/11/2014 at 18:22.
Pushed by arieder into branch 'frameworks'.

reenable and fix unit tests for the octave backend

M  +4    -3    src/CMakeLists.txt
M  +13   -9    src/backends/octave/CMakeLists.txt
M  +1    -1    src/backends/octave/octave-backend-config.h.cmake
M  +0    -7    src/backends/octave/octaveexpression.cpp
M  +9    -0    src/backends/octave/octaveexpression.h
M  +4    -2    src/backends/octave/testoctave.cpp

http://commits.kde.org/cantor/eb7f3432e49c3f1573c24aa3b40657a45c4631eb

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 420de53..1c1808b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,9 +4,10 @@
 add_subdirectory(lib)
 
 include_directories( lib ${CMAKE_CURRENT_BINARY_DIR}/lib)
-if(KDE4_BUILD_TESTS)
+if(BUILD_TESTING)
+  include(ECMMarkAsTest)
   include_directories( lib/test )
-endif(KDE4_BUILD_TESTS)
+endif(BUILD_TESTING)
 
 if(LIBSPECTRE_FOUND)
    include_directories(${LIBSPECTRE_INCLUDE_DIR})
@@ -114,4 +115,4 @@ install( FILES cantor_part.desktop  DESTINATION \
${SERVICES_INSTALL_DIR}/cantor )  install( FILES cantor_part.rc  DESTINATION  \
${DATA_INSTALL_DIR}/cantor )  install( FILES cantor_scripteditor.rc  DESTINATION \
${DATA_INSTALL_DIR}/cantor )  
-install(TARGETS cantorpart  DESTINATION ${PLUGIN_INSTALL_DIR} )
\ No newline at end of file
+install(TARGETS cantorpart  DESTINATION ${PLUGIN_INSTALL_DIR} )
diff --git a/src/backends/octave/CMakeLists.txt b/src/backends/octave/CMakeLists.txt
index 431bec2..189e2c2 100644
--- a/src/backends/octave/CMakeLists.txt
+++ b/src/backends/octave/CMakeLists.txt
@@ -11,6 +11,7 @@ octavesyntaxhelpobject.cpp
 )
 
 set (OCTAVE_SCRIPT_INSTALL_DIR ${DATA_INSTALL_DIR}/cantor/octavebackend)
+set (OCTAVE_SCRIPT_INSTALL_PATH \
${CMAKE_INSTALL_PREFIX}/${OCTAVE_SCRIPT_INSTALL_DIR}/)  configure_file \
(octave-backend-config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/octave-backend-config.h )  \
add_subdirectory(scripts)  
@@ -27,15 +28,18 @@ target_link_libraries(cantor_octavebackend
     KF5::ConfigGui
     )
 
-# add_executable( testoctave testoctave.cpp)
-# add_test(testoctave testoctave)
-# ecm_mark_as_test(testoctave)
-# target_link_libraries( testoctave
-#   KF5::KDELibs4Support
-#   Qt5::Test
-#   cantorlibs
-#   cantortest
-# )
+
+if(BUILD_TESTING)
+ add_executable( testoctave testoctave.cpp)
+ add_test(testoctave testoctave)
+ ecm_mark_as_test(testoctave)
+ target_link_libraries( testoctave
+   KF5::KDELibs4Support
+   Qt5::Test
+   cantorlibs
+   cantortest
+ )
+endif(BUILD_TESTING)
 
 install(FILES octavebackend.desktop  DESTINATION ${SERVICES_INSTALL_DIR}/cantor)
 install(TARGETS cantor_octavebackend DESTINATION ${PLUGIN_INSTALL_DIR})
diff --git a/src/backends/octave/octave-backend-config.h.cmake \
b/src/backends/octave/octave-backend-config.h.cmake index ebd059a..025cce8 100644
--- a/src/backends/octave/octave-backend-config.h.cmake
+++ b/src/backends/octave/octave-backend-config.h.cmake
@@ -1 +1 @@
-const QString octaveScriptInstallDir = \
QLatin1String("${OCTAVE_SCRIPT_INSTALL_DIR}"); +const QString octaveScriptInstallDir \
                = QLatin1String("${OCTAVE_SCRIPT_INSTALL_PATH}");
diff --git a/src/backends/octave/octaveexpression.cpp \
b/src/backends/octave/octaveexpression.cpp index c5a4029..44426ce 100644
--- a/src/backends/octave/octaveexpression.cpp
+++ b/src/backends/octave/octaveexpression.cpp
@@ -29,13 +29,6 @@
 
 #include <config-cantorlib.h>
 
-#ifdef WITH_EPS
-#include "epsresult.h"
-typedef Cantor::EpsResult OctavePlotResult;
-#else
-#include "imageresult.h"
-typedef Cantor::ImageResult OctavePlotResult;
-#endif
 
 static const char* printCommand = "cantor_print();";
 
diff --git a/src/backends/octave/octaveexpression.h \
b/src/backends/octave/octaveexpression.h index f6a780e..23b704e 100644
--- a/src/backends/octave/octaveexpression.h
+++ b/src/backends/octave/octaveexpression.h
@@ -23,6 +23,15 @@
 #include <expression.h>
 #include <QStringList>
 
+#ifdef WITH_EPS
+#include "epsresult.h"
+typedef Cantor::EpsResult OctavePlotResult;
+#else
+#include "imageresult.h"
+typedef Cantor::ImageResult OctavePlotResult;
+#endif
+
+
 
 class OctaveExpression : public Cantor::Expression
 {
diff --git a/src/backends/octave/testoctave.cpp b/src/backends/octave/testoctave.cpp
index fe9de9e..938cefd 100644
--- a/src/backends/octave/testoctave.cpp
+++ b/src/backends/octave/testoctave.cpp
@@ -27,6 +27,8 @@
 #include "imageresult.h"
 #include "epsresult.h"
 
+#include "octaveexpression.h"
+
 #include <QDebug>
 
 QString TestOctave::backendName()
@@ -61,7 +63,7 @@ void TestOctave::testPlot()
 
     int cnt=0;
     //give some time to create the image, but at most 5sec
-    while(e->result()==0)
+    while(e->result()==0||e->result()->type()!=OctavePlotResult::Type )
     {
         QTest::qWait(250);
         cnt+=250;
@@ -72,7 +74,7 @@ void TestOctave::testPlot()
     QVERIFY( e!=0 );
     QVERIFY( e->result()!=0 );
 
-    QCOMPARE( e->result()->type(), (int)Cantor::EpsResult::Type );
+    QCOMPARE( e->result()->type(), (int) OctavePlotResult::Type );
     QVERIFY( !e->result()->data().isNull() );
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic