From 933dc8a3f8b14eff9c51c1a7ece8c29754ad378a Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Wed, 21 Dec 2016 01:09:27 +0300 Subject: [PATCH] tdeio: add tests Signed-off-by: Alexander Golubev (cherry picked from commit ed74769bfaae171809c0bc1a10a8ba0f6ff8895f) --- kio/kfile/CMakeLists.txt | 2 + kio/kfile/tests/CMakeLists.txt | 40 +++++++++++++++++++ kio/kfile/tests/kcustommenueditortest.cpp | 2 +- kio/kfile/tests/kdirselectdialogtest.cpp | 2 +- .../{knotifytest.cpp => kfilenotifytest.cpp} | 2 +- kio/kfile/tests/kfiletreeviewtest.cpp | 2 +- kio/kfile/tests/kfstest.cpp | 2 +- kio/kfile/tests/kicondialogtest.cpp | 2 +- kio/kfile/tests/kopenwithtest.cpp | 2 +- kio/kfile/tests/kurlrequestertest.cpp | 2 +- kio/kio/dataprotocol.cpp | 2 +- kio/tests/CMakeLists.txt | 40 +++++++++++++++++++ kio/tests/dataprotocoltest.cpp | 4 +- kio/tests/getalltest.cpp | 2 +- kio/tests/jobtest.cpp | 2 +- kio/tests/kacltest.cpp | 2 +- kio/tests/kdcopcheck.cpp | 6 +-- kio/tests/kdefaultprogresstest.cpp | 2 +- kio/tests/kdirlistertest.cpp | 2 +- kio/tests/kioslavetest.cpp | 2 +- kio/tests/kmimetypetest.cpp | 21 ++++++---- kio/tests/kprotocolinfotest.cpp | 2 +- kio/tests/kruntest.cpp | 16 ++++---- kio/tests/kscantest.cpp | 4 +- kio/tests/ksycocatest.cpp | 6 +-- kio/tests/ksycocaupdatetest.cpp | 2 +- kio/tests/kurifiltertest.cpp | 14 ++++--- kio/tests/kurlcompletiontest.cpp | 2 +- kio/tests/netaccesstest.cpp | 2 +- kio/tests/previewtest.cpp | 2 +- 30 files changed, 143 insertions(+), 50 deletions(-) create mode 100644 kio/kfile/tests/CMakeLists.txt rename kio/kfile/tests/{knotifytest.cpp => kfilenotifytest.cpp} (78%) diff --git a/kio/kfile/CMakeLists.txt b/kio/kfile/CMakeLists.txt index e9e7540b7..d22a954da 100644 --- a/kio/kfile/CMakeLists.txt +++ b/kio/kfile/CMakeLists.txt @@ -9,6 +9,8 @@ # ################################################# +add_subdirectory( tests ) + include_directories( ${TQT_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} diff --git a/kio/kfile/tests/CMakeLists.txt b/kio/kfile/tests/CMakeLists.txt new file mode 100644 index 000000000..8e99208ba --- /dev/null +++ b/kio/kfile/tests/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################# +# +# (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_SOURCE_DIR}/dcop + ${CMAKE_BINARY_DIR}/kdecore + ${CMAKE_SOURCE_DIR}/kdecore + ${CMAKE_SOURCE_DIR}/kdeui + ${CMAKE_SOURCE_DIR}/kio + ${CMAKE_SOURCE_DIR}/kio/kfile + ${CMAKE_SOURCE_DIR}/kio/kio + ${CMAKE_BINARY_DIR}/kio/kfile +) + +link_directories( + ${TDECORE_LIBRARY_DIRS} +) + +tde_add_check_executable( kurlrequestertest LINK kio-shared ) +tde_add_check_executable( kopenwithtest LINK kio-shared ) +tde_add_check_executable( kdirselectdialogtest LINK kio-shared ) +tde_add_check_executable( kicondialogtest LINK kio-shared ) +tde_add_check_executable( kcustommenueditortest LINK kio-shared ) +tde_add_check_executable( kfilenotifytest LINK kio-shared ) + +tde_add_check_executable( kfiletreeviewtest AUTOMOC LINK kio-shared ) + +tde_add_check_executable( kfstest AUTOMOC + SOURCES kfstest.cpp kfdtest.cpp LINK kio-shared ) diff --git a/kio/kfile/tests/kcustommenueditortest.cpp b/kio/kfile/tests/kcustommenueditortest.cpp index 532297d0c..1cd4cb291 100644 --- a/kio/kfile/tests/kcustommenueditortest.cpp +++ b/kio/kfile/tests/kcustommenueditortest.cpp @@ -6,7 +6,7 @@ int main(int argc, char** argv) { KLocale::setMainCatalogue("kdelibs"); - KApplication app(argc, argv, "KCustomMenuEditorTest"); + KApplication app(argc, argv, "KCustomMenuEditorTest", true); KCustomMenuEditor editor(0); KConfig *cfg = new KConfig("kdesktop_custom_menu2"); editor.load(cfg); diff --git a/kio/kfile/tests/kdirselectdialogtest.cpp b/kio/kfile/tests/kdirselectdialogtest.cpp index 47fcd02ca..48dd35ca9 100644 --- a/kio/kfile/tests/kdirselectdialogtest.cpp +++ b/kio/kfile/tests/kdirselectdialogtest.cpp @@ -5,7 +5,7 @@ int main( int argc, char **argv ) { - KApplication app(argc, argv, "kdirselectdialogtest"); + KApplication app(argc, argv, "kdirselectdialogtest", true); KURL u = KDirSelectDialog::selectDirectory( (argc >= 1) ? argv[1] : TQString::null ); if ( u.isValid() ) diff --git a/kio/kfile/tests/knotifytest.cpp b/kio/kfile/tests/kfilenotifytest.cpp similarity index 78% rename from kio/kfile/tests/knotifytest.cpp rename to kio/kfile/tests/kfilenotifytest.cpp index e27893589..e6ff1ef87 100644 --- a/kio/kfile/tests/knotifytest.cpp +++ b/kio/kfile/tests/kfilenotifytest.cpp @@ -3,7 +3,7 @@ int main( int argc, char **argv ) { - KApplication app( argc, argv, "knotifytest" ); + KApplication app( argc, argv, "knotifytest", true ); KNotifyDialog *dlg = new KNotifyDialog(); dlg->addApplicationEvents( "kwin" ); return dlg->exec(); diff --git a/kio/kfile/tests/kfiletreeviewtest.cpp b/kio/kfile/tests/kfiletreeviewtest.cpp index 5c520dd5d..8c7033ed6 100644 --- a/kio/kfile/tests/kfiletreeviewtest.cpp +++ b/kio/kfile/tests/kfiletreeviewtest.cpp @@ -134,7 +134,7 @@ void testFrame::slotSetChildCount( KFileTreeViewItem *item, int c ) int main(int argc, char **argv) { - KApplication a(argc, argv, "kfiletreeviewtest"); + KApplication a(argc, argv, "kfiletreeviewtest", true); TQString name1; TQStringList names; diff --git a/kio/kfile/tests/kfstest.cpp b/kio/kfile/tests/kfstest.cpp index b84cbc967..4157fba88 100644 --- a/kio/kfile/tests/kfstest.cpp +++ b/kio/kfile/tests/kfstest.cpp @@ -44,7 +44,7 @@ int main(int argc, char **argv) { - KApplication a(argc, argv, "kfstest"); + KApplication a(argc, argv, "kfstest", true); TQString name1; TQStringList names; diff --git a/kio/kfile/tests/kicondialogtest.cpp b/kio/kfile/tests/kicondialogtest.cpp index 23301b752..e3de3d587 100644 --- a/kio/kfile/tests/kicondialogtest.cpp +++ b/kio/kfile/tests/kicondialogtest.cpp @@ -3,7 +3,7 @@ int main( int argc, char **argv ) { - KApplication app( argc, argv, "kicondialogtest" ); + KApplication app( argc, argv, "kicondialogtest", true ); // KIconDialog::getIcon(); diff --git a/kio/kfile/tests/kopenwithtest.cpp b/kio/kfile/tests/kopenwithtest.cpp index ea348a94c..b072d4b83 100644 --- a/kio/kfile/tests/kopenwithtest.cpp +++ b/kio/kfile/tests/kopenwithtest.cpp @@ -28,7 +28,7 @@ int main(int argc, char **argv) { - KApplication app(argc, argv, "kopenwithtest"); + KApplication app(argc, argv, "kopenwithtest", true); KURL::List list; list += KURL("file:///tmp/testfile.txt"); diff --git a/kio/kfile/tests/kurlrequestertest.cpp b/kio/kfile/tests/kurlrequestertest.cpp index 9248eec5d..3ed8d1d18 100644 --- a/kio/kfile/tests/kurlrequestertest.cpp +++ b/kio/kfile/tests/kurlrequestertest.cpp @@ -5,7 +5,7 @@ int main( int argc, char **argv ) { - KApplication app( argc, argv, "kurlrequestertest" ); + KApplication app( argc, argv, "kurlrequestertest", true ); KURL url = KURLRequesterDlg::getURL( "ftp://ftp.kde.org" ); qDebug( "Selected url: %s", url.url().latin1()); diff --git a/kio/kio/dataprotocol.cpp b/kio/kio/dataprotocol.cpp index 161c82296..8818c1a21 100644 --- a/kio/kio/dataprotocol.cpp +++ b/kio/kio/dataprotocol.cpp @@ -33,7 +33,7 @@ # include #endif #ifdef TESTKIO -# include +# include #endif #if !defined(DATAKIOSLAVE) && !defined(TESTKIO) diff --git a/kio/tests/CMakeLists.txt b/kio/tests/CMakeLists.txt index 9c4fb7427..02ffd9eb5 100644 --- a/kio/tests/CMakeLists.txt +++ b/kio/tests/CMakeLists.txt @@ -11,8 +11,14 @@ include_directories( ${TQT_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/dcop ${CMAKE_BINARY_DIR}/kdecore ${CMAKE_SOURCE_DIR}/kdecore + ${CMAKE_SOURCE_DIR}/kdeui + ${CMAKE_SOURCE_DIR}/kio + ${CMAKE_SOURCE_DIR}/kio/kfile ${CMAKE_SOURCE_DIR}/kio/kio ) @@ -34,3 +40,37 @@ tde_add_executable( ${target} LINK kio-shared DESTINATION ${BIN_INSTALL_DIR} ) + + +##### check and test ############################## + +# Force assertions to work +add_definitions( -UNDEBUG ) + +set( CHECKS + getalltest jobtest kdcopcheck kdefaultprogresstest kdirlistertest + kdirwatchtest kfiltertest kionetrctest kiopassdlgtest kmfitest kmimefromext + kmimemagictest kpropsdlgtest kprotocolinfotest kruntest kscantest kshredtest + ktartest kurifiltertest kurlcompletiontest kziptest metatest netaccesstest + previewtest speed kioslavetest ksycocatest ksycocaupdatetest +) + +foreach( _check ${CHECKS} ) + tde_add_check_executable( ${_check} AUTOMOC LINK kio-shared ) +endforeach( ) + +# NOTE some apps here are suitable to be run as tests but not included due to +# following reasons: +# - jobtest may fail if run on an unusual system configuration +# and requires GUI +# - kprotocolinfotest tries to connect to network and requires running DCOP +# - kurifiltertest requires network access and GUI +# - ksycocatest requires installed kdebase and GUI + +set( TESTS dataprotocoltest kacltest kmimetypetest ) + +foreach( _check ${TESTS} ) + tde_add_check_executable( ${_check} AUTOMOC LINK kio-shared TEST) +endforeach( ) + +# TODO add kdirwatchunittest diff --git a/kio/tests/dataprotocoltest.cpp b/kio/tests/dataprotocoltest.cpp index 0c8470a61..69af00368 100644 --- a/kio/tests/dataprotocoltest.cpp +++ b/kio/tests/dataprotocoltest.cpp @@ -21,7 +21,9 @@ #include #include -#include +#include + +using namespace std; class KURL; diff --git a/kio/tests/getalltest.cpp b/kio/tests/getalltest.cpp index 58c8d5a3f..c0c008857 100644 --- a/kio/tests/getalltest.cpp +++ b/kio/tests/getalltest.cpp @@ -7,7 +7,7 @@ int main(int argc, char *argv[]) { - KApplication k(argc,argv,"getalltest",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption + KApplication k(argc,argv,"getalltest",false/*nostyle*/,false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption //for (int i = 0 ; i < 2 ; ++i ) { // test twice to see if they got deleted kdDebug() << "All services" << endl; diff --git a/kio/tests/jobtest.cpp b/kio/tests/jobtest.cpp index fb2b001db..a50cf83f9 100644 --- a/kio/tests/jobtest.cpp +++ b/kio/tests/jobtest.cpp @@ -200,7 +200,7 @@ void JobTest::get() kapp->eventLoop()->enterLoop(); assert( m_result == 0 ); // no error assert( m_data.size() == 11 ); - assert( TQCString( m_data ) == "Hello world" ); + assert( memcmp (m_data, "Hello world", m_data.size()) == 0 ); // m_data is not null-terminated } void JobTest::slotGetResult( KIO::Job* job ) diff --git a/kio/tests/kacltest.cpp b/kio/tests/kacltest.cpp index 58ae319b2..5bf5ad111 100644 --- a/kio/tests/kacltest.cpp +++ b/kio/tests/kacltest.cpp @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) { KApplication::disableAutoDcopRegistration(); KCmdLineArgs::init(argc,argv,"kacltest", 0, 0, 0, 0); - KApplication app; + KApplication app(/*styles=*/false, /*gui=*/false); KACLTest test; test.setup(); diff --git a/kio/tests/kdcopcheck.cpp b/kio/tests/kdcopcheck.cpp index b61dfd03d..23ff6605c 100644 --- a/kio/tests/kdcopcheck.cpp +++ b/kio/tests/kdcopcheck.cpp @@ -90,14 +90,14 @@ int TestService::exec() int main(int argc, char *argv[]) { - putenv("IGNORE_SYCOCA_VERSION=true"); - KApplication k(argc,argv,"whatever",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption + setenv("IGNORE_SYCOCA_VERSION", "true", true); + KApplication k(argc,argv,"whatever",false/*nostyle*/,false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption k.dcopClient()->setNotifications(true); KService::List list = KService::allServices(); - qWarning("I found %d services.", list.count()); + qWarning("I found %ld services.", list.count()); int i = 0; for(KService::List::ConstIterator it = list.begin(); it != list.end(); ++it) { diff --git a/kio/tests/kdefaultprogresstest.cpp b/kio/tests/kdefaultprogresstest.cpp index a831041e1..963940ead 100644 --- a/kio/tests/kdefaultprogresstest.cpp +++ b/kio/tests/kdefaultprogresstest.cpp @@ -7,7 +7,7 @@ using namespace KIO; int main(int argc, char **argv) { - KApplication app(argc, argv, "kdefaultprogresstest"); + KApplication app(argc, argv, "kdefaultprogresstest",true,true); DefaultProgress* dlg = new DefaultProgress(); KURL src("http://this.host.doesn't.exist/this/dir/neither/andthisfileneither"); diff --git a/kio/tests/kdirlistertest.cpp b/kio/tests/kdirlistertest.cpp index 6137f5e71..a42c2412b 100644 --- a/kio/tests/kdirlistertest.cpp +++ b/kio/tests/kdirlistertest.cpp @@ -151,7 +151,7 @@ void KDirListerTest::completed() int main ( int argc, char *argv[] ) { - KApplication app( argc, argv, "kdirlistertest" ); + KApplication app( argc, argv, "kdirlistertest", true /*styles*/ ); KDirListerTest *test = new KDirListerTest( 0 ); test->show(); diff --git a/kio/tests/kioslavetest.cpp b/kio/tests/kioslavetest.cpp index 0db23457d..fcf5df617 100644 --- a/kio/tests/kioslavetest.cpp +++ b/kio/tests/kioslavetest.cpp @@ -452,7 +452,7 @@ void KioslaveTest::slotDataReq(KIO::Job*, TQByteArray &data) "Hello world\n", "This is a test file\n", "You can safely delete it.\n", - "BIG\n", + "BIG\n", 0 }; const char *fileData = fileDataArray[putBuffer++]; diff --git a/kio/tests/kmimetypetest.cpp b/kio/tests/kmimetypetest.cpp index 1856e6036..46c705521 100644 --- a/kio/tests/kmimetypetest.cpp +++ b/kio/tests/kmimetypetest.cpp @@ -36,6 +36,17 @@ static void checkIcon( const KURL& url, const TQString& expectedIcon ) } } +static void checkExtention( const TQString& fileName, const TQString& expectedExtention ) { + TQString ext; + KMimeType::diagnoseFileName(fileName, ext); + if ( ext == expectedExtention) { + qDebug("extension of %s is '%s: OK'", fileName.latin1(), ext.latin1()); + } else { + qDebug("extension of %s is '%s, expected %s!'", fileName.latin1(), ext.latin1(), expectedExtention.latin1()); + exit(1); + } +} + int main( int argc, char** argv ) { KInstance blah("kmimetypetest"); @@ -63,14 +74,8 @@ int main( int argc, char** argv ) checkIcon( "trash:/foo/", "folder" ); } - TQString pdf; - KMimeType::diagnoseFileName("foo.pdf", pdf); - qDebug("extension: '%s'", pdf.latin1()); - assert(pdf == TQString("*.pdf")); - TQString ps; - KMimeType::diagnoseFileName("foo.ps", ps); - qDebug("extension: '%s'", ps.latin1()); - assert(ps == TQString("*.ps")); + checkExtention(TQString::fromLatin1("foo.pdf"), TQString::fromLatin1("*.pdf")); + checkExtention(TQString::fromLatin1("foo.ps"), TQString::fromLatin1("*.ps")); return 0; } diff --git a/kio/tests/kprotocolinfotest.cpp b/kio/tests/kprotocolinfotest.cpp index b0fe392f2..e64fbef66 100644 --- a/kio/tests/kprotocolinfotest.cpp +++ b/kio/tests/kprotocolinfotest.cpp @@ -30,7 +30,7 @@ int main(int argc, char **argv) { "1.0"); KCmdLineArgs::init(argc, argv, &aboutData); - KApplication app; + KApplication app(/*styles=*/false, /*gui=*/false); KURL url; url.setPath("/tmp"); diff --git a/kio/tests/kruntest.cpp b/kio/tests/kruntest.cpp index 10dbc9b71..3e026cd5d 100644 --- a/kio/tests/kruntest.cpp +++ b/kio/tests/kruntest.cpp @@ -121,7 +121,7 @@ void checkPDE(const KService &service, const KURL::List &urls, bool hs, bool tf, int main(int argc, char **argv) { - KApplication app( argc, argv, "kruntest", true /* it _has_ a GUI ! */); + KApplication app( argc, argv, "kruntest", true /*styles*/, true /* it _has_ a GUI ! */); // First some non-interactive tests checkBN( "/usr/bin/ls", true, "ls"); @@ -164,16 +164,16 @@ int main(int argc, char **argv) for (int te = 0; te < 2; te++) for (int ex = 0; ex < 2; ex++) { int fd = creat("kruntest.desktop", 0666); - FILE *f; + FILE *f; if (fd < 0) abort(); - f = KDE_fdopen(fd, "w"); + f = KDE_fdopen(fd, "w"); fprintf(f, "[Desktop Entry]\n" - "Type=Application\n" - "Name=just_a_test\n" - "Icon=~/icon.png\n" - "%s\n%s\n%s\n",execs[ex],terms[te],sus[su]); + "Type=Application\n" + "Name=just_a_test\n" + "Icon=~/icon.png\n" + "%s\n%s\n%s\n",execs[ex],terms[te],sus[su]); close(fd); - fclose(f); + fclose(f); KService s(TQDir::currentDirPath() + "/kruntest.desktop"); unlink("kruntest.desktop"); checkPDE( s, l0, hs, false, rslts[ex+te*2+su*4+hs*8]); diff --git a/kio/tests/kscantest.cpp b/kio/tests/kscantest.cpp index 9bc9d2ebc..6e798083c 100644 --- a/kio/tests/kscantest.cpp +++ b/kio/tests/kscantest.cpp @@ -3,11 +3,11 @@ int main( int argc, char **argv ) { - KApplication app( argc, argv, "kscantest" ); + KApplication app( argc, argv, "kscantest", true, true ); KScanDialog *dlg = KScanDialog::getScanDialog(); if ( !dlg ) { qDebug("*** EEK, no Scan-service available, aborting!"); - return 0; + return EXIT_FAILURE; } dlg->show(); diff --git a/kio/tests/ksycocatest.cpp b/kio/tests/ksycocatest.cpp index 4a4fcabb0..12f5a4cad 100644 --- a/kio/tests/ksycocatest.cpp +++ b/kio/tests/ksycocatest.cpp @@ -43,7 +43,7 @@ bool check(TQString txt, TQString a, TQString b) kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl; } else { - kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl + kdError() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl ; exit(1); } @@ -52,7 +52,7 @@ bool check(TQString txt, TQString a, TQString b) void debug(TQString txt) { - fprintf(stderr, "%s\n", txt.ascii()); + fprintf(stderr, "%s\n", txt.utf8().data()); } void debug(const char *txt) @@ -67,7 +67,7 @@ void debug(const char *format, const char *txt) int main(int argc, char *argv[]) { - KApplication k(argc,argv,"whatever",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption + KApplication k(argc,argv,"whatever",true); // KMessageBox needs KApp for makeStdCaption TQCString instname = "kword"; TQString desktopPath = TQString::fromLatin1( "Office/%1.desktop" ).arg( instname ); diff --git a/kio/tests/ksycocaupdatetest.cpp b/kio/tests/ksycocaupdatetest.cpp index 1d9e3fcaa..db2a0420a 100644 --- a/kio/tests/ksycocaupdatetest.cpp +++ b/kio/tests/ksycocaupdatetest.cpp @@ -4,7 +4,7 @@ int main(int argc, char *argv[]) { - KApplication k(argc,argv,"whatever"); // KMessageBox needs KApp for makeStdCaption + KApplication k(argc,argv,"whatever",true,true); // KMessageBox needs KApp for makeStdCaption KService::rebuildKSycoca(0); return 0; diff --git a/kio/tests/kurifiltertest.cpp b/kio/tests/kurifiltertest.cpp index c6c2a3e8e..8a416829c 100644 --- a/kio/tests/kurifiltertest.cpp +++ b/kio/tests/kurifiltertest.cpp @@ -155,14 +155,14 @@ int main(int argc, char **argv) { // Ensure that user configuration doesn't change the results of those tests // KDEHOME needs to be writable though, for a ksycoca database - setenv( "KDEHOME", TQFile::encodeName( TQDir::homeDirPath() + "/.kde-kurifiltertest" ), true ); + setenv( "KDEHOME", TQFile::encodeName( TQDir::currentDirPath() + "/.kde-kurifiltertest" ), true ); setenv( "KDE_FORK_SLAVES", "yes", true ); // simpler, for the final cleanup KAboutData aboutData(appName, programName, version, description); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); - KApplication app; + KApplication app; // it _is_ GUI app app.disableAutoDcopRegistration(); // Allow testing of the search engine using both delimiters... @@ -294,7 +294,9 @@ int main(int argc, char **argv) filter( "$SOMEVAR/kdelibs/kio", 0, KURIFilterData::ERROR ); // note: this dir doesn't exist... filter( "$ETC/passwd", "/etc/passwd", KURIFilterData::LOCAL_FILE ); - filter( "$QTDIR/doc/html/functions.html#s", TQCString("file://")+qtdir+"/doc/html/functions.html#s", KURIFilterData::LOCAL_FILE ); + if( !qtdir.isEmpty() ) { + filter( "$QTDIR/doc/html/functions.html#s", TQCString("file://")+qtdir+"/doc/html/functions.html#s", KURIFilterData::LOCAL_FILE ); + } filter( "http://www.kde.org/$USER", "http://www.kde.org/$USER", KURIFilterData::NET_PROTOCOL ); // no expansion // Assume the default (~/.trinity) if @@ -333,13 +335,15 @@ int main(int argc, char **argv) // the shortURI filter will return the string // itself if the requested environment variable // is not already set. - filter( "$QTDIR", 0, KURIFilterData::LOCAL_DIR, "kshorturifilter" ); //use specific filter. + if( !qtdir.isEmpty() ) { + filter( "$QTDIR", 0, KURIFilterData::LOCAL_DIR, "kshorturifilter" ); //use specific filter. + } filter( "$HOME", home, KURIFilterData::LOCAL_DIR, "kshorturifilter" ); //use specific filter. TQCString sc; filter( sc.sprintf("gg%cfoo bar",delimiter), "http://www.google.com/search?q=foo+bar&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL ); - filter( sc.sprintf("bug%c55798", delimiter), "http://bugs.kde.org/show_bug.cgi?id=55798", KURIFilterData::NET_PROTOCOL ); + filter( sc.sprintf("bug%c55798", delimiter), "http://bugs.pearsoncomputing.net/show_bug.cgi?id=55798", KURIFilterData::NET_PROTOCOL ); filter( sc.sprintf("gg%cC++", delimiter), "http://www.google.com/search?q=C%2B%2B&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL ); filter( sc.sprintf("ya%cfoo bar was here", delimiter), 0, -1 ); // this triggers default search, i.e. google diff --git a/kio/tests/kurlcompletiontest.cpp b/kio/tests/kurlcompletiontest.cpp index 612dab558..3836308b3 100644 --- a/kio/tests/kurlcompletiontest.cpp +++ b/kio/tests/kurlcompletiontest.cpp @@ -166,7 +166,7 @@ int main( int argc, char **argv ) { KApplication::disableAutoDcopRegistration(); KCmdLineArgs::init(argc,argv,"kurlcompletiontest", 0, 0, 0, 0); - KApplication app; + KApplication app(/*styles=*/false, /*gui=*/false); { KURLCompletionTest test; diff --git a/kio/tests/netaccesstest.cpp b/kio/tests/netaccesstest.cpp index 9fb0ff07a..f66f7b73c 100644 --- a/kio/tests/netaccesstest.cpp +++ b/kio/tests/netaccesstest.cpp @@ -24,7 +24,7 @@ int main(int argc, char **argv) { - KApplication app( argc, argv, "netaccesstest", true /* it _has_ a GUI ! */); + KApplication app( argc, argv, "netaccesstest", true /*styles*/, true /* it _has_ a GUI ! */); KURL srcURL( "ftp://ftp.kde.org/pub/kde/README" ); KURL tmpURL( "file:/tmp/netaccesstest_README" ); diff --git a/kio/tests/previewtest.cpp b/kio/tests/previewtest.cpp index f2b740224..6d302d023 100644 --- a/kio/tests/previewtest.cpp +++ b/kio/tests/previewtest.cpp @@ -55,7 +55,7 @@ void PreviewTest::slotFailed() int main(int argc, char **argv) { - KApplication app(argc, argv, "previewtest"); + KApplication app(argc, argv, "previewtest", true, true); PreviewTest *w = new PreviewTest; w->show(); app.setMainWidget(w);