From 3385fb91e1e55e1bfa1f78dfb8ce2e9f3fdaedef Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 24 Nov 2011 10:36:10 +1000 Subject: Fixed installation of corelib tests In .pro files, removed wince/symbian-specific DEPLOYMENT cases and replaced them with TESTDATA where appropriate. In .cpp files, removed SRCDIR and relative paths to testdata and replaced them with the QFINDTESTDATA macro where appropriate. Modified test helper apps/libs to install themselves under the test they relate to. This change allows corelib tests to be correctly installed, along with their testdata, via `make install'. Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304 Reviewed-by: Jason McDonald --- tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp') diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 5908c335c2..f47c02f93d 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -56,6 +56,8 @@ public: protected: bool event(QEvent *event); private slots: + void initTestCase(); + void load(); void load2(); void threadLoad(); @@ -76,6 +78,14 @@ tst_QTranslator::tst_QTranslator() hide(); } +void tst_QTranslator::initTestCase() +{ + // chdir into the directory containing our testdata, + // to make the code simpler (load testdata via relative paths) + QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath(); + QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir)); +} + bool tst_QTranslator::event(QEvent *event) { if (event->type() == QEvent::LanguageChange) @@ -228,10 +238,11 @@ void tst_QTranslator::loadFromResource() void tst_QTranslator::loadDirectory() { - QVERIFY(QFileInfo("../qtranslator").isDir()); + QString current_base = QDir::current().dirName(); + QVERIFY(QFileInfo("../" + current_base).isDir()); QTranslator tor; - tor.load("qtranslator", ".."); + tor.load(current_base, ".."); QVERIFY(tor.isEmpty()); } -- cgit v1.2.3