diff options
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r-- | tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp | 27 | ||||
-rw-r--r-- | tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 696a1c4722..060ef99d65 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -903,6 +903,33 @@ void tst_QCoreApplication::threadedEventDelivery() QCOMPARE(receiver.recordedEvents.contains(QEvent::User + 1), eventsReceived); } +void tst_QCoreApplication::addRemoveLibPaths() +{ + QStringList paths = QCoreApplication::libraryPaths(); + if (paths.isEmpty()) + QSKIP("Cannot add/remove library paths if there are none."); + + QString currentDir = QDir().absolutePath(); + QCoreApplication::addLibraryPath(currentDir); + QVERIFY(QCoreApplication::libraryPaths().contains(currentDir)); + + QCoreApplication::removeLibraryPath(paths[0]); + QVERIFY(!QCoreApplication::libraryPaths().contains(paths[0])); + + int argc = 1; + char *argv[] = { const_cast<char*>(QTest::currentAppName()) }; + TestApplication app(argc, argv); + + // Check that modifications stay alive across the creation of an application. + QVERIFY(QCoreApplication::libraryPaths().contains(currentDir)); + QVERIFY(!QCoreApplication::libraryPaths().contains(paths[0])); + + QStringList replace; + replace << currentDir << paths[0]; + QCoreApplication::setLibraryPaths(replace); + QVERIFY(QCoreApplication::libraryPaths() == replace); +} + static void createQObjectOnDestruction() { // Make sure that we can create a QObject after the last QObject has been diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h index 8efe374a2b..d9296b3846 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h @@ -63,6 +63,7 @@ private slots: void applicationEventFilters_auxThread(); void threadedEventDelivery_data(); void threadedEventDelivery(); + void addRemoveLibPaths(); }; #endif // TST_QCOREAPPLICATION_H |