Changeset View
Changeset View
Standalone View
Standalone View
autotests/krununittest.cpp
Show First 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | |||||
363 | 363 | | |||
364 | static void createSrcFile(const QString path) | 364 | static void createSrcFile(const QString path) | ||
365 | { | 365 | { | ||
366 | QFile srcFile(path); | 366 | QFile srcFile(path); | ||
367 | QVERIFY2(srcFile.open(QFile::WriteOnly), qPrintable(srcFile.errorString())); | 367 | QVERIFY2(srcFile.open(QFile::WriteOnly), qPrintable(srcFile.errorString())); | ||
368 | srcFile.write("Hello world\n"); | 368 | srcFile.write("Hello world\n"); | ||
369 | } | 369 | } | ||
370 | 370 | | |||
371 | #if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 71) | ||||
371 | void KRunUnitTest::KRunRunService_data() | 372 | void KRunUnitTest::KRunRunService_data() | ||
372 | { | 373 | { | ||
373 | QTest::addColumn<bool>("tempFile"); | 374 | QTest::addColumn<bool>("tempFile"); | ||
374 | QTest::addColumn<bool>("useRunApplication"); | 375 | QTest::addColumn<bool>("useRunApplication"); | ||
375 | 376 | | |||
376 | QTest::newRow("standard") << false << false; | 377 | QTest::newRow("standard") << false << false; | ||
377 | QTest::newRow("tempfile") << true << false; | 378 | QTest::newRow("tempfile") << true << false; | ||
378 | QTest::newRow("runApp") << false << true; | 379 | QTest::newRow("runApp") << false << true; | ||
379 | QTest::newRow("runApp_tempfile") << true << true; | 380 | QTest::newRow("runApp_tempfile") << true << true; | ||
380 | } | 381 | } | ||
382 | #endif | ||||
383 | | ||||
384 | #if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 71) | ||||
381 | void KRunUnitTest::KRunRunService() | 385 | void KRunUnitTest::KRunRunService() | ||
382 | { | 386 | { | ||
383 | QFETCH(bool, tempFile); | 387 | QFETCH(bool, tempFile); | ||
384 | QFETCH(bool, useRunApplication); | 388 | QFETCH(bool, useRunApplication); | ||
385 | 389 | | |||
386 | // Given a service desktop file and a source file | 390 | // Given a service desktop file and a source file | ||
387 | const QString path = createTempService(); | 391 | const QString path = createTempService(); | ||
388 | //KService::Ptr service = KService::serviceByDesktopPath(s_tempServiceName); | 392 | //KService::Ptr service = KService::serviceByDesktopPath(s_tempServiceName); | ||
Show All 19 Lines | |||||
408 | QVERIFY(QFile::exists(srcFile)); // if tempfile is true, kioexec will delete it... in 3 minutes. | 412 | QVERIFY(QFile::exists(srcFile)); // if tempfile is true, kioexec will delete it... in 3 minutes. | ||
409 | 413 | | |||
410 | // All done, clean up. | 414 | // All done, clean up. | ||
411 | QVERIFY(QFile::remove(dest)); | 415 | QVERIFY(QFile::remove(dest)); | ||
412 | #ifdef Q_OS_UNIX | 416 | #ifdef Q_OS_UNIX | ||
413 | ::kill(pid, SIGTERM); | 417 | ::kill(pid, SIGTERM); | ||
414 | #endif | 418 | #endif | ||
415 | } | 419 | } | ||
420 | #endif | ||||
416 | 421 | | |||
417 | QString KRunUnitTest::createTempService() | 422 | QString KRunUnitTest::createTempService() | ||
418 | { | 423 | { | ||
419 | // fakeservice: deleted and recreated by testKSycocaUpdate, don't use in other tests | 424 | // fakeservice: deleted and recreated by testKSycocaUpdate, don't use in other tests | ||
420 | const QString fileName = s_tempServiceName; | 425 | const QString fileName = s_tempServiceName; | ||
421 | //bool mustUpdateKSycoca = !KService::serviceByDesktopPath(fileName); | 426 | //bool mustUpdateKSycoca = !KService::serviceByDesktopPath(fileName); | ||
422 | const QString fakeService = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kservices5/") + fileName; | 427 | const QString fakeService = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kservices5/") + fileName; | ||
423 | if (!QFile::exists(fakeService)) { | 428 | if (!QFile::exists(fakeService)) { | ||
Show All 17 Lines |