From 0c64a776ddecfa33a37318e79b8811d9774579ae Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Tue, 28 Jun 2016 05:07:09 +0300 Subject: [PATCH] Initial add for check target for cmake Signed-off-by: Alexander Golubev --- CMakeLists.txt | 1 + tdecore/CMakeLists.txt | 1 + tdecore/tdeaccelmanager.cpp | 3 +- tdecore/tests/CMakeLists.txt | 56 +++++++++++++++++++++++++++ tdecore/tests/kdebugtest.cpp | 2 +- tdecore/tests/kiconloadertest.cpp | 2 +- tdecore/tests/kipctest.cpp | 2 +- tdecore/tests/klocaletest.cpp | 2 +- tdecore/tests/kmemtest.cpp | 2 +- tdecore/tests/knotifytest.cpp | 2 +- tdecore/tests/kprocesstest.cpp | 2 +- tdecore/tests/kprociotest.cpp | 2 +- tdecore/tests/krandomsequencetest.cpp | 2 +- tdecore/tests/kresolvertest.cpp | 10 ++--- tdecore/tests/kshelltest.cpp | 2 +- tdecore/tests/ksimpleconfigtest.cpp | 2 +- tdecore/tests/kstringhandlertest.cpp | 1 + tdecore/tests/ktempfiletest.cpp | 2 +- tdecore/tests/ktimezonestest.cpp | 10 ++--- tdecore/tests/tdeconfigtestgui.cpp | 2 +- 20 files changed, 83 insertions(+), 25 deletions(-) create mode 100644 tdecore/tests/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 18c6dcfeb..c6fa9abdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,7 @@ include( TDESetupPaths ) tde_setup_paths( ) tde_setup_architecture_flags( ) +enable_testing( ) find_package( TQt ) list( APPEND TDECORE_LIBRARY_DIRS ${TQT_LIBRARY_DIRS} ) diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt index 4d9c4a4a8..dd9bbe76e 100644 --- a/tdecore/CMakeLists.txt +++ b/tdecore/CMakeLists.txt @@ -12,6 +12,7 @@ add_subdirectory( malloc ) add_subdirectory( network ) add_subdirectory( tdeconfig_compiler ) +add_subdirectory( tests ) if( WITH_TDEHWLIB ) add_subdirectory( tdehw ) diff --git a/tdecore/tdeaccelmanager.cpp b/tdecore/tdeaccelmanager.cpp index 5fcfcc450..4618dab17 100644 --- a/tdecore/tdeaccelmanager.cpp +++ b/tdecore/tdeaccelmanager.cpp @@ -47,7 +47,6 @@ #include "tdeaccelmanager_private.h" #include "../tdeui/kstdaction_p.h" -#include "../tdeutils/tdemultitabbar.h" /********************************************************************* @@ -321,7 +320,7 @@ void TDEAcceleratorManagerPrivate::manageWidget(TQWidget *w, Item *item) if (dynamic_cast(w) || dynamic_cast(w) || dynamic_cast(w) || dynamic_cast(w) || - dynamic_cast(w) || static_cast(w->tqt_cast("KMultiTabBar"))) + dynamic_cast(w) || w->tqt_cast("KMultiTabBar")) return; // now treat 'ordinary' widgets diff --git a/tdecore/tests/CMakeLists.txt b/tdecore/tests/CMakeLists.txt new file mode 100644 index 000000000..7e16a6d89 --- /dev/null +++ b/tdecore/tests/CMakeLists.txt @@ -0,0 +1,56 @@ +################################################# +# +# (C) 2016 Alexander Golubev +# fatzer2 (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${TQT_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} + ${CMAKE_BINARY_DIR}/tdecore + ${CMAKE_SOURCE_DIR}/tdecore + ${CMAKE_SOURCE_DIR}/dcop +) + +link_directories( + ${TDECORE_LIBRARY_DIRS} +) + +tde_add_library( tdeconfigtest SHARED AUTOMOC + SOURCES tdeconfigtest.cpp + LINK tdeunittest-shared + EXCLUDE_FROM_ALL +) + +set( CHECKS + tdeconfigtestgui klocaletest kprocesstest ksimpleconfigtest kstddirstest + kurltest kuniqueapptest ktempfiletest krandomsequencetest kdebugtest + ksocktest kstringhandlertest kcmdlineargstest kapptest kmemtest + dcopkonqtest kipctest cplusplustest kiconloadertest kresolvertest + kmdcodectest knotifytest ksortablevaluelisttest krfcdatetest testqtargs + kprociotest kcharsetstest kcalendartest kmacroexpandertest kshelltest + kxerrorhandlertest startserviceby tdestdacceltest kglobaltest ktimezonestest +) + +set( TESTS kurltest tdestdacceltest ) + +foreach( _check ${CHECKS} ) + tde_add_check_executable( ${_check} AUTOMOC LINK tdeconfigtest-shared ) +endforeach( ) + +tde_add_check_executable( kidlservertest AUTOMOC SOURCES KIDLTest.cpp KIDLTest.skel + LINK tdeconfigtest-shared ) +tde_add_check_executable( kidlclienttest AUTOMOC SOURCES KIDLTestClient.cpp + KIDLTest.stub LINK tdeconfigtest-shared ) + +foreach( _test ${TESTS}) + add_test( ${_test} ${_test} ) +endforeach( ) diff --git a/tdecore/tests/kdebugtest.cpp b/tdecore/tests/kdebugtest.cpp index cc85b4554..4052d5dcf 100644 --- a/tdecore/tests/kdebugtest.cpp +++ b/tdecore/tests/kdebugtest.cpp @@ -59,7 +59,7 @@ public: il << 1 << 2 << 3 << 4 << 5; kdDebug() << "TQValueList filled: " << il << endl; - Q_LLONG big = 65536LL*65536*500; + TQ_LLONG big = 65536LL*65536*500; kdDebug() << big << endl; TQVariant v( 0.12345 ); diff --git a/tdecore/tests/kiconloadertest.cpp b/tdecore/tests/kiconloadertest.cpp index c6da1994c..5c9e65a28 100644 --- a/tdecore/tests/kiconloadertest.cpp +++ b/tdecore/tests/kiconloadertest.cpp @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { - TDEApplication app(argc,argv,"kiconloadertest"/*,false,false*/); + TDEApplication app(argc,argv,TQCString("kiconloadertest")/*,false,false*/); TDEIconLoader * mpLoader = TDEGlobal::iconLoader(); TDEIcon::Context mContext = TDEIcon::Application; diff --git a/tdecore/tests/kipctest.cpp b/tdecore/tests/kipctest.cpp index af6785f0c..d1a678ac9 100644 --- a/tdecore/tests/kipctest.cpp +++ b/tdecore/tests/kipctest.cpp @@ -18,7 +18,7 @@ MyObject::MyObject() int main(int argc, char **argv) { - TDEApplication app(argc, argv, "kipc"); + TDEApplication app(argc, argv, TQCString("kipc")); if (argc == 3) { diff --git a/tdecore/tests/klocaletest.cpp b/tdecore/tests/klocaletest.cpp index 2b02c22a4..5f4d1da2a 100644 --- a/tdecore/tests/klocaletest.cpp +++ b/tdecore/tests/klocaletest.cpp @@ -100,7 +100,7 @@ void Test::createFields() int main( int argc, char ** argv ) { TDELocale::setMainCatalogue("tdelibs"); - TDEApplication a( argc, argv, "klocaletest" ); + TDEApplication a( argc, argv, TQCString("klocaletest") ); TDEGlobal::locale()->setLanguage(TQString::fromLatin1("en_US")); TDEGlobal::locale()->setCountry(TQString::fromLatin1("C")); diff --git a/tdecore/tests/kmemtest.cpp b/tdecore/tests/kmemtest.cpp index f0115b569..c36fac555 100644 --- a/tdecore/tests/kmemtest.cpp +++ b/tdecore/tests/kmemtest.cpp @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) } // showMem("second"); - TDEApplication app(argc,argv,"kurltest"); + TDEApplication app(argc,argv,TQCString("kurltest")); // showMem("After TDEApplication constructor"); diff --git a/tdecore/tests/knotifytest.cpp b/tdecore/tests/knotifytest.cpp index 6c5af25a7..2ccd1f911 100644 --- a/tdecore/tests/knotifytest.cpp +++ b/tdecore/tests/knotifytest.cpp @@ -3,7 +3,7 @@ int main( int argc, char **argv ) { - TDEApplication app( argc, argv, "knotifytest" ); + TDEApplication app( argc, argv, TQCString("knotifytest") ); KNotifyClient::userEvent( "This is a notification to notify you :)", KNotifyClient::Messagebox, KNotifyClient::Error ); diff --git a/tdecore/tests/kprocesstest.cpp b/tdecore/tests/kprocesstest.cpp index c81dada50..d8d86d988 100644 --- a/tdecore/tests/kprocesstest.cpp +++ b/tdecore/tests/kprocesstest.cpp @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { TDEProcess p1, p2, p3, p4; Dummy dummy; - TDEApplication app(argc, argv, "kprocesstest"); + TDEApplication app(argc, argv, TQCString("kprocesstest")); printf("Welcome to the TDEProcess Demo Application!\n"); diff --git a/tdecore/tests/kprociotest.cpp b/tdecore/tests/kprociotest.cpp index ee7aaf2b7..f7e895345 100644 --- a/tdecore/tests/kprociotest.cpp +++ b/tdecore/tests/kprociotest.cpp @@ -32,7 +32,7 @@ werke\nmerkt\nich\nund\nden\nbrauch\nund\nmit\ngeistesstaerke\ntu\nich\nwunder\n int main(int argc, char *argv[]) { Dummy dummy; - TDEApplication app(argc, argv, "kprociotest"); + TDEApplication app(argc, argv, TQCString("kprociotest")); printf("Welcome to the KProcIO Demo Application!\n"); diff --git a/tdecore/tests/krandomsequencetest.cpp b/tdecore/tests/krandomsequencetest.cpp index 2ba0c72ae..44f1ce15a 100644 --- a/tdecore/tests/krandomsequencetest.cpp +++ b/tdecore/tests/krandomsequencetest.cpp @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) { - TDEApplication a(argc, argv, "krandomsequencetest"); + TDEApplication a(argc, argv, TQCString("krandomsequencetest")); long seed; KRandomSequence seq; diff --git a/tdecore/tests/kresolvertest.cpp b/tdecore/tests/kresolvertest.cpp index 0e05cab4e..9f476cd51 100644 --- a/tdecore/tests/kresolvertest.cpp +++ b/tdecore/tests/kresolvertest.cpp @@ -176,17 +176,17 @@ bool testKernel() printf("succeeded\n"); if (getsockname(sock, (struct sockaddr*)&sin6, &len) == 0) - printf("\tSize of kernel's sockaddr_in6 is %d bytes\n", len); + printf("\tSize of kernel's sockaddr_in6 is %lu bytes\n", (unsigned long)len); else printf("\tCould not get socket name\n"); } - printf("\tSize of TDE's internal sockaddr_in6 is %d bytes\n", - sizeof(kde_sockaddr_in6)); + printf("\tSize of TDE's internal sockaddr_in6 is %lu bytes\n", + (unsigned long)sizeof(kde_sockaddr_in6)); # ifdef HAVE_SOCKADDR_IN6 - printf("\tSize of system libraries' sockaddr_in6 is %d bytes\n", - sizeof(sockaddr_in6)); + printf("\tSize of system libraries' sockaddr_in6 is %lu bytes\n", + (unsigned long)sizeof(sockaddr_in6)); # else printf("\tSystem libraries don't define sockaddr_in6\n"); # endif diff --git a/tdecore/tests/kshelltest.cpp b/tdecore/tests/kshelltest.cpp index 394394e28..be5f9ef30 100644 --- a/tdecore/tests/kshelltest.cpp +++ b/tdecore/tests/kshelltest.cpp @@ -2,7 +2,7 @@ #include -static QCString +static TQCString ps(const TQString &s) { if (s.isNull()) diff --git a/tdecore/tests/ksimpleconfigtest.cpp b/tdecore/tests/ksimpleconfigtest.cpp index 8b0e4ef25..ca91581dd 100644 --- a/tdecore/tests/ksimpleconfigtest.cpp +++ b/tdecore/tests/ksimpleconfigtest.cpp @@ -20,7 +20,7 @@ int main( int argc, char **argv ) { - TDEApplication a( argc, argv, "tdeconfigtest" ); + TDEApplication a( argc, argv, TQCString("tdeconfigtest") ); KSimpleConfig aConfig( _PATH_TMP"/simpleconfig.cfg" ); diff --git a/tdecore/tests/kstringhandlertest.cpp b/tdecore/tests/kstringhandlertest.cpp index 2efdc96fc..e98dd5d5c 100644 --- a/tdecore/tests/kstringhandlertest.cpp +++ b/tdecore/tests/kstringhandlertest.cpp @@ -1,5 +1,6 @@ #include "kstringhandler.h" #include +#include using std::cout; using std::endl; diff --git a/tdecore/tests/ktempfiletest.cpp b/tdecore/tests/ktempfiletest.cpp index 5c2354fff..019db0690 100644 --- a/tdecore/tests/ktempfiletest.cpp +++ b/tdecore/tests/ktempfiletest.cpp @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) { - TDEApplication a(argc, argv, "ktempfiletest"); + TDEApplication a(argc, argv, TQCString("ktempfiletest")); printf("Making tempfile after TDEApplication constructor.\n"); KTempFile f4; printf("Filename = %s\n", f4.name().ascii()); diff --git a/tdecore/tests/ktimezonestest.cpp b/tdecore/tests/ktimezonestest.cpp index 5eaf5a4fb..d00626cdf 100644 --- a/tdecore/tests/ktimezonestest.cpp +++ b/tdecore/tests/ktimezonestest.cpp @@ -20,7 +20,7 @@ int main(int argc, char *argv[]) printf( "UTC timezone offset should be 0: %d\n", timezone->offset(TQDateTime::currentDateTime()) ); // Find some offsets for Europe/London. - char *london = "Europe/London"; + const char *london = "Europe/London"; timezone = timezones.zone(london); TQDateTime winter(TQDateTime::fromString("2005-01-01T00:00:00", Qt::ISODate)); TQDateTime summer(TQDateTime::fromString("2005-06-01T00:00:00", Qt::ISODate)); @@ -29,10 +29,10 @@ int main(int argc, char *argv[]) // Try timezone conversions. const KTimezone *losAngeles = timezones.zone("America/Los_Angeles"); - char *bstBeforePdt = "2005-03-28T00:00:00"; - char *bstAfterPdt = "2005-05-01T00:00:00"; - char *gmtBeforePst = "2005-10-30T01:00:00"; - char *gmtAfterPst = "2005-12-01T00:00:00"; + const char *bstBeforePdt = "2005-03-28T00:00:00"; + const char *bstAfterPdt = "2005-05-01T00:00:00"; + const char *gmtBeforePst = "2005-10-30T01:00:00"; + const char *gmtAfterPst = "2005-12-01T00:00:00"; TQString result; result = timezone->convert(losAngeles, TQDateTime::fromString(bstBeforePdt, Qt::ISODate)).toString(Qt::ISODate); printf( "BST before PDT, %s should be 2005-03-27T15:00:00: %s\n", bstBeforePdt, result.latin1() ); diff --git a/tdecore/tests/tdeconfigtestgui.cpp b/tdecore/tests/tdeconfigtestgui.cpp index d1e2d5393..f5ea428c0 100644 --- a/tdecore/tests/tdeconfigtestgui.cpp +++ b/tdecore/tests/tdeconfigtestgui.cpp @@ -192,7 +192,7 @@ void TDEConfigTestView::writeButtonClicked() int main( int argc, char **argv ) { - TDEApplication a( argc, argv, "bla" ); + TDEApplication a( argc, argv, TQCString ("bla") ); TDEConfigTestView *w = new TDEConfigTestView(); a.setMainWidget( w );