From d851010a10c9a75fd8fb165bc239d5d3b805c0b8 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Wed, 16 Sep 2009 13:08:51 +0200 Subject: Fixed QImageReader autotests. Reviewed-by: Kim --- tests/auto/qimagereader/tst_qimagereader.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 8d5cd34..fdc9c86 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -642,7 +642,7 @@ void tst_QImageReader::imageFormatBeforeRead() void tst_QImageReader::gifHandlerBugs() { { - QImageReader io("images/trolltech.gif"); + QImageReader io(":images/trolltech.gif"); QVERIFY(io.loopCount() != 1); int count=0; for (; io.canRead(); io.read(), ++count) ; @@ -651,8 +651,8 @@ void tst_QImageReader::gifHandlerBugs() // Task 95166 { - QImageReader io1("images/bat1.gif"); - QImageReader io2("images/bat2.gif"); + QImageReader io1(":images/bat1.gif"); + QImageReader io2(":images/bat2.gif"); QVERIFY(io1.canRead()); QVERIFY(io2.canRead()); QImage im1 = io1.read(); @@ -664,8 +664,8 @@ void tst_QImageReader::gifHandlerBugs() // Task 9994 { - QImageReader io1("images/noclearcode.gif"); - QImageReader io2("images/noclearcode.bmp"); + QImageReader io1(":images/noclearcode.gif"); + QImageReader io2(":images/noclearcode.bmp"); QVERIFY(io1.canRead()); QVERIFY(io2.canRead()); QImage im1 = io1.read(); QImage im2 = io2.read(); QVERIFY(!im1.isNull()); QVERIFY(!im2.isNull()); @@ -675,13 +675,14 @@ void tst_QImageReader::gifHandlerBugs() void tst_QImageReader::animatedGif() { - QImageReader io(prefix + "qt.gif"); - QImage image= io.read(); - int i=0; + QImageReader io(":images/qt.gif"); + QImage image = io.read(); + QVERIFY(!image.isNull()); + int i = 0; while(!image.isNull()){ - QString frameName = QString(prefix + "qt%1.gif").arg(++i); + QString frameName = QString(":images/qt%1.gif").arg(++i); QCOMPARE(image, QImage(frameName)); - image=io.read(); + image = io.read(); } } #endif -- cgit v0.12 From 706028b5684de47addcf580599df5fad1b0cd6a3 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Wed, 16 Sep 2009 13:22:25 +0200 Subject: Fixed the QThread tests for Windows. Backported d04d67e146bce3d407f992c283d7ab3d0c25d428 and 08b54f274d57e4735d0042e295237f176506433d from 4.6. --- tests/auto/qthread/tst_qthread.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index 34b74d8..587622e 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -629,6 +629,12 @@ void noop(void*) { } typedef HANDLE ThreadHandle; #endif +#ifdef Q_OS_WIN +#define WIN_FIX_STDCALL __stdcall +#else +#define WIN_FIX_STDCALL +#endif + class NativeThreadWrapper { public: @@ -639,7 +645,7 @@ public: void setWaitForStop() { waitForStop = true; } void stop(); - ThreadHandle nativeThread; + ThreadHandle nativeThreadHandle; QThread *qthread; QWaitCondition startCondition; QMutex mutex; @@ -647,7 +653,7 @@ public: QWaitCondition stopCondition; protected: static void *runUnix(void *data); - static void runWin(void *data); + static unsigned WIN_FIX_STDCALL runWin(void *data); FunctionPointer functionPointer; void *data; @@ -658,12 +664,13 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data) this->functionPointer = functionPointer; this->data = data; #ifdef Q_OS_UNIX - const int state = pthread_create(&nativeThread, 0, NativeThreadWrapper::runUnix, this); + const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this); Q_UNUSED(state); #elif defined(Q_OS_WINCE) - nativeThread = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL); + nativeThreadHandle = CreateThread(NULL, 0 , (LPTHREAD_START_ROUTINE)NativeThreadWrapper::runWin , this, 0, NULL); #elif defined Q_OS_WIN - nativeThread = (HANDLE)_beginthread(NativeThreadWrapper::runWin, 0, this); + unsigned thrdid = 0; + nativeThreadHandle = (Qt::HANDLE) _beginthreadex(NULL, 0, NativeThreadWrapper::runWin, this, 0, &thrdid); #endif } @@ -677,9 +684,10 @@ void NativeThreadWrapper::startAndWait(FunctionPointer functionPointer, void *da void NativeThreadWrapper::join() { #ifdef Q_OS_UNIX - pthread_join(nativeThread, 0); + pthread_join(nativeThreadHandle, 0); #elif defined Q_OS_WIN - WaitForSingleObject(nativeThread, INFINITE); + WaitForSingleObject(nativeThreadHandle, INFINITE); + CloseHandle(nativeThreadHandle); #endif } @@ -687,7 +695,7 @@ void *NativeThreadWrapper::runUnix(void *that) { NativeThreadWrapper *nativeThreadWrapper = reinterpret_cast(that); - // Adoppt thread, create QThread object. + // Adopt thread, create QThread object. nativeThreadWrapper->qthread = QThread::currentThread(); // Release main thread. @@ -709,9 +717,10 @@ void *NativeThreadWrapper::runUnix(void *that) return 0; } -void NativeThreadWrapper::runWin(void *data) +unsigned WIN_FIX_STDCALL NativeThreadWrapper::runWin(void *data) { runUnix(data); + return 0; } void NativeThreadWrapper::stop() -- cgit v0.12 From 93df7f3b8e0e29ee7ed75a5f54222f26387cc793 Mon Sep 17 00:00:00 2001 From: Trond Kjernaasen Date: Wed, 16 Sep 2009 13:39:06 +0200 Subject: Disabled the qtwidgets test for the times being. Reviewed-by: Jesper --- tests/auto/qtwidgets/tst_qtwidgets.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qtwidgets/tst_qtwidgets.cpp b/tests/auto/qtwidgets/tst_qtwidgets.cpp index f5f638e..237c3f3 100644 --- a/tests/auto/qtwidgets/tst_qtwidgets.cpp +++ b/tests/auto/qtwidgets/tst_qtwidgets.cpp @@ -59,6 +59,8 @@ private slots: void tst_QtWidgets::snapshot() { + QSKIP("This test doesn't do anything useful at the moment.", SkipAll); + StyleWidget widget(0, Qt::X11BypassWindowManagerHint); widget.show(); -- cgit v0.12 From 59dbb1b7e737713fc650c25a20967ec26cc3ff3d Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Wed, 16 Sep 2009 16:00:19 +0200 Subject: Fixed the qkeysequence::translated autotest. The test failed because it tried to open a .qm file which didn't exist in Qt's translations directory. Fixed by running lrelease on the .ts file and copying the resulting .qm into the test directory. Reviewed-by: Trond --- tests/auto/qkeysequence/qkeysequence.pro | 4 +--- tests/auto/qkeysequence/qkeysequence.qrc | 6 ++++++ tests/auto/qkeysequence/qt_de.qm | Bin 0 -> 186240 bytes tests/auto/qkeysequence/tst_qkeysequence.cpp | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 tests/auto/qkeysequence/qkeysequence.qrc create mode 100644 tests/auto/qkeysequence/qt_de.qm diff --git a/tests/auto/qkeysequence/qkeysequence.pro b/tests/auto/qkeysequence/qkeysequence.pro index 6566340..bd85402 100644 --- a/tests/auto/qkeysequence/qkeysequence.pro +++ b/tests/auto/qkeysequence/qkeysequence.pro @@ -1,6 +1,4 @@ load(qttest_p4) SOURCES += tst_qkeysequence.cpp -TRANSLATIONS += keys_de.ts - - +RESOURCES += qkeysequence.qrc \ No newline at end of file diff --git a/tests/auto/qkeysequence/qkeysequence.qrc b/tests/auto/qkeysequence/qkeysequence.qrc new file mode 100644 index 0000000..e224faa --- /dev/null +++ b/tests/auto/qkeysequence/qkeysequence.qrc @@ -0,0 +1,6 @@ + + + keys_de.qm + qt_de.qm + + diff --git a/tests/auto/qkeysequence/qt_de.qm b/tests/auto/qkeysequence/qt_de.qm new file mode 100644 index 0000000..595e4d7 Binary files /dev/null and b/tests/auto/qkeysequence/qt_de.qm differ diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp index 9da0671..868f843 100644 --- a/tests/auto/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp @@ -166,9 +166,9 @@ tst_QKeySequence::~tst_QKeySequence() void tst_QKeySequence::initTestCase() { ourTranslator = new QTranslator(this); - ourTranslator->load(QLatin1String("keys_de"), "."); + ourTranslator->load(":/keys_de"); qtTranslator = new QTranslator(this); - qtTranslator->load(QLatin1String("qt_de"), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + qtTranslator->load(":/qt_de"); } void tst_QKeySequence::operatorQString_data() -- cgit v0.12