From f088e398856b58e486ddda87dfd343c8d93b4433 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 (cherry picked from commit 0c64a776ddecfa33a37318e79b8811d9774579ae) --- CMakeLists.txt | 1 + kdecore/CMakeLists.txt | 1 + kdecore/kaccelmanager.cpp | 3 +- kdecore/tests/CMakeLists.txt | 56 +++++++++++++++++++++++++++ kdecore/tests/kconfigtestgui.cpp | 2 +- kdecore/tests/kdebugtest.cpp | 2 +- kdecore/tests/kiconloadertest.cpp | 2 +- kdecore/tests/kipctest.cpp | 2 +- kdecore/tests/klocaletest.cpp | 2 +- kdecore/tests/kmemtest.cpp | 2 +- kdecore/tests/knotifytest.cpp | 2 +- kdecore/tests/kprocesstest.cpp | 2 +- kdecore/tests/kprociotest.cpp | 2 +- kdecore/tests/krandomsequencetest.cpp | 2 +- kdecore/tests/kresolvertest.cpp | 10 ++--- kdecore/tests/kshelltest.cpp | 2 +- kdecore/tests/ksimpleconfigtest.cpp | 2 +- kdecore/tests/kstringhandlertest.cpp | 1 + kdecore/tests/ktempfiletest.cpp | 2 +- kdecore/tests/ktimezonestest.cpp | 10 ++--- 20 files changed, 83 insertions(+), 25 deletions(-) create mode 100644 kdecore/tests/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2259adbfc..c176f370e 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/kdecore/CMakeLists.txt b/kdecore/CMakeLists.txt index ebebdb08d..93e54b332 100644 --- a/kdecore/CMakeLists.txt +++ b/kdecore/CMakeLists.txt @@ -12,6 +12,7 @@ add_subdirectory( malloc ) add_subdirectory( network ) add_subdirectory( kconfig_compiler ) +add_subdirectory( tests ) if( WITH_LIBART ) add_subdirectory( svgicons ) diff --git a/kdecore/kaccelmanager.cpp b/kdecore/kaccelmanager.cpp index 821711964..84fc5d52b 100644 --- a/kdecore/kaccelmanager.cpp +++ b/kdecore/kaccelmanager.cpp @@ -47,7 +47,6 @@ #include "kaccelmanager_private.h" #include "../kdeui/kstdaction_p.h" -#include "../kutils/kmultitabbar.h" /********************************************************************* @@ -321,7 +320,7 @@ void KAcceleratorManagerPrivate::manageWidget(TQWidget *w, Item *item) if (dynamic_cast(w) || dynamic_cast(w) || dynamic_cast(w) || dynamic_cast(w) || - dynamic_cast(w) || static_cast(w->qt_cast("KMultiTabBar"))) + dynamic_cast(w) || w->qt_cast("KMultiTabBar")) return; // now treat 'ordinary' widgets diff --git a/kdecore/tests/CMakeLists.txt b/kdecore/tests/CMakeLists.txt new file mode 100644 index 000000000..37bd67cfb --- /dev/null +++ b/kdecore/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}/kdecore + ${CMAKE_SOURCE_DIR}/kdecore + ${CMAKE_SOURCE_DIR}/dcop +) + +link_directories( + ${TDECORE_LIBRARY_DIRS} +) + +tde_add_library( kconfigtest SHARED AUTOMOC + SOURCES kconfigtest.cpp + LINK kunittest-shared + EXCLUDE_FROM_ALL +) + +set( CHECKS + kconfigtestgui 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 kstdacceltest kglobaltest ktimezonestest +) + +set( TESTS kurltest kstdacceltest ) + +foreach( _check ${CHECKS} ) + tde_add_check_executable( ${_check} AUTOMOC LINK kconfigtest-shared ) +endforeach( ) + +tde_add_check_executable( kidlservertest AUTOMOC SOURCES KIDLTest.cpp KIDLTest.skel + LINK kconfigtest-shared ) +tde_add_check_executable( kidlclienttest AUTOMOC SOURCES KIDLTestClient.cpp + KIDLTest.stub LINK kconfigtest-shared ) + +foreach( _test ${TESTS}) + add_test( ${_test} ${_test} ) +endforeach( ) diff --git a/kdecore/tests/kconfigtestgui.cpp b/kdecore/tests/kconfigtestgui.cpp index af560b496..fe0cf518a 100644 --- a/kdecore/tests/kconfigtestgui.cpp +++ b/kdecore/tests/kconfigtestgui.cpp @@ -192,7 +192,7 @@ void KConfigTestView::writeButtonClicked() int main( int argc, char **argv ) { - KApplication a( argc, argv, "bla" ); + KApplication a( argc, argv, TQCString ("bla") ); KConfigTestView *w = new KConfigTestView(); a.setMainWidget( w ); diff --git a/kdecore/tests/kdebugtest.cpp b/kdecore/tests/kdebugtest.cpp index ee49127ea..0e7ce614b 100644 --- a/kdecore/tests/kdebugtest.cpp +++ b/kdecore/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/kdecore/tests/kiconloadertest.cpp b/kdecore/tests/kiconloadertest.cpp index 96a7a6813..feb4662a4 100644 --- a/kdecore/tests/kiconloadertest.cpp +++ b/kdecore/tests/kiconloadertest.cpp @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { - KApplication app(argc,argv,"kiconloadertest"/*,false,false*/); + KApplication app(argc,argv,TQCString("kiconloadertest")/*,false,false*/); KIconLoader * mpLoader = KGlobal::iconLoader(); KIcon::Context mContext = KIcon::Application; diff --git a/kdecore/tests/kipctest.cpp b/kdecore/tests/kipctest.cpp index 136aa6d70..9114ffd2c 100644 --- a/kdecore/tests/kipctest.cpp +++ b/kdecore/tests/kipctest.cpp @@ -18,7 +18,7 @@ MyObject::MyObject() int main(int argc, char **argv) { - KApplication app(argc, argv, "kipc"); + KApplication app(argc, argv, TQCString("kipc")); if (argc == 3) { diff --git a/kdecore/tests/klocaletest.cpp b/kdecore/tests/klocaletest.cpp index 64d68a0f0..f48d8fc7f 100644 --- a/kdecore/tests/klocaletest.cpp +++ b/kdecore/tests/klocaletest.cpp @@ -100,7 +100,7 @@ void Test::createFields() int main( int argc, char ** argv ) { KLocale::setMainCatalogue("kdelibs"); - KApplication a( argc, argv, "klocaletest" ); + KApplication a( argc, argv, TQCString("klocaletest") ); KGlobal::locale()->setLanguage(TQString::fromLatin1("en_US")); KGlobal::locale()->setCountry(TQString::fromLatin1("C")); diff --git a/kdecore/tests/kmemtest.cpp b/kdecore/tests/kmemtest.cpp index 83c452e50..3060d1199 100644 --- a/kdecore/tests/kmemtest.cpp +++ b/kdecore/tests/kmemtest.cpp @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) } // showMem("second"); - KApplication app(argc,argv,"kurltest"); + KApplication app(argc,argv,TQCString("kurltest")); // showMem("After KApplication constructor"); diff --git a/kdecore/tests/knotifytest.cpp b/kdecore/tests/knotifytest.cpp index 8eb0586c0..104c0c299 100644 --- a/kdecore/tests/knotifytest.cpp +++ b/kdecore/tests/knotifytest.cpp @@ -3,7 +3,7 @@ int main( int argc, char **argv ) { - KApplication app( argc, argv, "knotifytest" ); + KApplication app( argc, argv, TQCString("knotifytest") ); KNotifyClient::userEvent( "This is a notification to notify you :)", KNotifyClient::Messagebox, KNotifyClient::Error ); diff --git a/kdecore/tests/kprocesstest.cpp b/kdecore/tests/kprocesstest.cpp index af04cd421..eb5f21224 100644 --- a/kdecore/tests/kprocesstest.cpp +++ b/kdecore/tests/kprocesstest.cpp @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { KProcess p1, p2, p3, p4; Dummy dummy; - KApplication app(argc, argv, "kprocesstest"); + KApplication app(argc, argv, TQCString("kprocesstest")); printf("Welcome to the KProcess Demo Application!\n"); diff --git a/kdecore/tests/kprociotest.cpp b/kdecore/tests/kprociotest.cpp index 446dacb30..7ab32db46 100644 --- a/kdecore/tests/kprociotest.cpp +++ b/kdecore/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; - KApplication app(argc, argv, "kprociotest"); + KApplication app(argc, argv, TQCString("kprociotest")); printf("Welcome to the KProcIO Demo Application!\n"); diff --git a/kdecore/tests/krandomsequencetest.cpp b/kdecore/tests/krandomsequencetest.cpp index 8f337c2f1..e671c4367 100644 --- a/kdecore/tests/krandomsequencetest.cpp +++ b/kdecore/tests/krandomsequencetest.cpp @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) { - KApplication a(argc, argv, "krandomsequencetest"); + KApplication a(argc, argv, TQCString("krandomsequencetest")); long seed; KRandomSequence seq; diff --git a/kdecore/tests/kresolvertest.cpp b/kdecore/tests/kresolvertest.cpp index f1d3c11f9..e6c67b85e 100644 --- a/kdecore/tests/kresolvertest.cpp +++ b/kdecore/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 KDE's internal sockaddr_in6 is %d bytes\n", - sizeof(kde_sockaddr_in6)); + printf("\tSize of KDE'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/kdecore/tests/kshelltest.cpp b/kdecore/tests/kshelltest.cpp index 394394e28..be5f9ef30 100644 --- a/kdecore/tests/kshelltest.cpp +++ b/kdecore/tests/kshelltest.cpp @@ -2,7 +2,7 @@ #include -static QCString +static TQCString ps(const TQString &s) { if (s.isNull()) diff --git a/kdecore/tests/ksimpleconfigtest.cpp b/kdecore/tests/ksimpleconfigtest.cpp index 699be34cf..acf3d7a68 100644 --- a/kdecore/tests/ksimpleconfigtest.cpp +++ b/kdecore/tests/ksimpleconfigtest.cpp @@ -20,7 +20,7 @@ int main( int argc, char **argv ) { - KApplication a( argc, argv, "kconfigtest" ); + KApplication a( argc, argv, TQCString("kconfigtest") ); KSimpleConfig aConfig( _PATH_TMP"/simpleconfig.cfg" ); diff --git a/kdecore/tests/kstringhandlertest.cpp b/kdecore/tests/kstringhandlertest.cpp index 2efdc96fc..e98dd5d5c 100644 --- a/kdecore/tests/kstringhandlertest.cpp +++ b/kdecore/tests/kstringhandlertest.cpp @@ -1,5 +1,6 @@ #include "kstringhandler.h" #include +#include using std::cout; using std::endl; diff --git a/kdecore/tests/ktempfiletest.cpp b/kdecore/tests/ktempfiletest.cpp index 60404f03a..b214e95ff 100644 --- a/kdecore/tests/ktempfiletest.cpp +++ b/kdecore/tests/ktempfiletest.cpp @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) { - KApplication a(argc, argv, "ktempfiletest"); + KApplication a(argc, argv, TQCString("ktempfiletest")); printf("Making tempfile after KApplication constructor.\n"); KTempFile f4; printf("Filename = %s\n", f4.name().ascii()); diff --git a/kdecore/tests/ktimezonestest.cpp b/kdecore/tests/ktimezonestest.cpp index 650cc0512..185ab8782 100644 --- a/kdecore/tests/ktimezonestest.cpp +++ b/kdecore/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() );