diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2012-09-28 11:41:15 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-30 05:02:24 (GMT) |
commit | 3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1 (patch) | |
tree | 9cacee6fdb7be5b66cb1642b03486d93d8e3c41d /tests/auto/qclipboard | |
parent | 5267c575d60b9f1f0415e8affbd38c28c4cd3873 (diff) | |
download | Qt-3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1.zip Qt-3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1.tar.gz Qt-3f10b20e56c0f5a3768becf8a9e21b5d00a66bc1.tar.bz2 |
Fix autotests that no longer find executables on Windows.
The tests are now run from the 'debug',
'release' subdirectories on Windows by 'make check'.
Go up one directory so that the relative paths are correct.
Non-network tests.
Change-Id: I8d0f806ff6708c3111a39c861ed46b21881acc7b
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Diffstat (limited to 'tests/auto/qclipboard')
-rw-r--r-- | tests/auto/qclipboard/test/test.pro | 2 | ||||
-rw-r--r-- | tests/auto/qclipboard/tst_qclipboard.cpp | 35 |
2 files changed, 32 insertions, 5 deletions
diff --git a/tests/auto/qclipboard/test/test.pro b/tests/auto/qclipboard/test/test.pro index c15162c..2e8f6db 100644 --- a/tests/auto/qclipboard/test/test.pro +++ b/tests/auto/qclipboard/test/test.pro @@ -30,5 +30,3 @@ wince*|symbian: { DEPLOYMENT += copier paster rsc reg_resource } - -win32:CONFIG+=insignificant_test # QTQAINFRA-428 diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp index 79213ea..e6b3aa6 100644 --- a/tests/auto/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/qclipboard/tst_qclipboard.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include <QtCore/QDebug> +#include <QtCore/QDir> #include <QtGui/QApplication> #include <QtGui/QClipboard> #ifdef Q_WS_MAC @@ -63,7 +64,7 @@ class tst_QClipboard : public QObject { Q_OBJECT private slots: - + void initTestCase(); void copy_exit_paste(); void capabiliyFunctions(); void modes(); @@ -78,8 +79,36 @@ private slots: private: bool nativeClipboardWorking(); + + QString m_copier; + QString m_paster; }; +void tst_QClipboard::initTestCase() +{ + QDir workingDirectory = QDir::current(); + QString copier = QLatin1String("copier/copier"); + QString paster = QLatin1String("paster/paster"); + // Windows: cd up to be able to locate the binary of the sub-process. +#ifdef Q_OS_WIN + const QString suffix = QLatin1String(".exe"); + copier.append(suffix); + paster.append(suffix); + if (workingDirectory.absolutePath().endsWith(QLatin1String("/debug"), Qt::CaseInsensitive) + || workingDirectory.absolutePath().endsWith(QLatin1String("/release"), Qt::CaseInsensitive)) { + QVERIFY(workingDirectory.cdUp()); + QVERIFY(QDir::setCurrent(workingDirectory.absolutePath())); + } +#endif + m_copier = workingDirectory.absoluteFilePath(copier); + m_paster = workingDirectory.absoluteFilePath(paster); + QVERIFY2(QFileInfo(m_copier).exists(), + qPrintable(QString::fromLatin1("Copier executable '%1' does not exist!") + .arg(QDir::toNativeSeparators(m_copier)))); + QVERIFY2(QFileInfo(m_paster).exists(), + qPrintable(QString::fromLatin1("Paster executable '%1' does not exist!") + .arg(QDir::toNativeSeparators(m_paster)))); +} bool tst_QClipboard::nativeClipboardWorking() { @@ -215,12 +244,12 @@ void tst_QClipboard::copy_exit_paste() if (!nativeClipboardWorking()) QSKIP("Native clipboard not working in this setup", SkipAll); const QStringList stringArgument = QStringList() << "Test string."; - QCOMPARE(QProcess::execute("copier/copier", stringArgument), 0); + QCOMPARE(QProcess::execute(m_copier, stringArgument), 0); #ifdef Q_WS_MAC // The Pasteboard needs a moment to breathe (at least on older Macs). QTest::qWait(100); #endif - QCOMPARE(QProcess::execute("paster/paster", stringArgument), 0); + QCOMPARE(QProcess::execute(m_paster, stringArgument), 0); #endif } |