summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-10 09:07:19 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-10 09:07:19 (GMT)
commita3256014d6adb31c89b0e5de5b0decc393649b70 (patch)
treecd315ffdb3e35f4040b268e9dc083244da084b2a /tests
parentb17cc4918bfc4b250293000bdabcb8f2dbdec787 (diff)
parent2c232cdbce3eba095da26362b964f411a9d3ba80 (diff)
downloadQt-a3256014d6adb31c89b0e5de5b0decc393649b70.zip
Qt-a3256014d6adb31c89b0e5de5b0decc393649b70.tar.gz
Qt-a3256014d6adb31c89b0e5de5b0decc393649b70.tar.bz2
Merge branch '4.6'
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp40
-rw-r--r--tests/auto/headers/tst_headers.cpp8
-rw-r--r--tests/auto/network-settings.h21
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp4
-rw-r--r--tests/auto/qbuttongroup/tst_qbuttongroup.cpp4
-rw-r--r--tests/auto/qdir/qdir.pro20
-rw-r--r--tests/auto/qdirmodel/qdirmodel.pro4
-rw-r--r--tests/auto/qfile/test/test.pro8
-rw-r--r--tests/auto/qfiledialog/qfiledialog.pro6
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp16
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp145
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp76
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp24
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp44
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp87
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp2
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp8
-rw-r--r--tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp19
-rw-r--r--tests/auto/qsqldriver/tst_qsqldriver.cpp4
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp2
-rw-r--r--tests/auto/qthread/tst_qthread.cpp27
-rw-r--r--tests/auto/selftests/tst_selftests.cpp12
-rw-r--r--tests/manual/qtabletevent/event_compression/mousestatwidget.cpp8
23 files changed, 397 insertions, 192 deletions
diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
index 1bd9aac..420962d 100644
--- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
+++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp
@@ -49,8 +49,8 @@ QT_USE_NAMESPACE
// this test only works with
// * GLIBC
// * MSVC - only debug builds (we need the crtdbg.h helpers)
-// * SYMBIAN - only when __UHEAP_BURSTFAILNEXT is available
-#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && (!defined(Q_OS_SYMBIAN) || !defined(__UHEAP_BURSTFAILNEXT)))) && !defined(Q_MOC_RUN)
+// * SYMBIAN
+#if (defined(QT_NO_EXCEPTIONS) || (!defined(__GLIBC__) && !defined(Q_CC_MSVC) && !defined(Q_OS_SYMBIAN))) && !defined(Q_MOC_RUN)
QTEST_NOOP_MAIN
#else
@@ -65,6 +65,7 @@ class tst_ExceptionSafetyObjects: public QObject
public slots:
void initTestCase();
+ void cleanupTestCase();
private slots:
void objects_data();
@@ -81,6 +82,10 @@ private slots:
void linkedList_data();
void linkedList();
+
+private:
+ static QtMsgHandler testMessageHandler;
+ static void safeMessageHandler(QtMsgType, const char *);
};
// helper structs to create an arbitrary widget
@@ -268,8 +273,22 @@ public:
}
};
+QtMsgHandler tst_ExceptionSafetyObjects::testMessageHandler;
+
+void tst_ExceptionSafetyObjects::safeMessageHandler(QtMsgType type, const char *msg)
+{
+ // this temporarily suspends OOM testing while handling a message
+ int currentIndex = mallocFailIndex;
+ AllocFailer allocFailer(0);
+ allocFailer.deactivate();
+ (*testMessageHandler)(type, msg);
+ allocFailer.reactivateAt(currentIndex);
+}
+
void tst_ExceptionSafetyObjects::initTestCase()
{
+ testMessageHandler = qInstallMsgHandler(safeMessageHandler);
+
QVERIFY(AllocFailer::initialize());
// sanity check whether OOM simulation works
@@ -307,6 +326,11 @@ void tst_ExceptionSafetyObjects::initTestCase()
QCOMPARE(malloc2Failed, 1);
}
+void tst_ExceptionSafetyObjects::cleanupTestCase()
+{
+ qInstallMsgHandler(testMessageHandler);
+}
+
void tst_ExceptionSafetyObjects::objects()
{
QFETCH(AbstractTester *, objectCreator);
@@ -347,6 +371,13 @@ template <> struct WidgetCreator<QDesktopWidget> : public AbstractTester
};
void tst_ExceptionSafetyObjects::widgets_data()
{
+#ifdef Q_OS_SYMBIAN
+ // Initialise the S60 rasteriser, which crashes if started while out of memory
+ QImage image(20, 20, QImage::Format_RGB32);
+ QPainter p(&image);
+ p.drawText(0, 15, "foo");
+#endif
+
QTest::addColumn<AbstractTester *>("widgetCreator");
#undef NEWROW
@@ -392,9 +423,6 @@ void tst_ExceptionSafetyObjects::widgets_data()
NEWROW(QToolBox);
NEWROW(QToolButton);
NEWROW(QStatusBar);
- NEWROW(QSplitter);
- NEWROW(QTextEdit);
- NEWROW(QTextBrowser);
NEWROW(QToolBar);
NEWROW(QMenuBar);
NEWROW(QMainWindow);
@@ -502,7 +530,7 @@ struct IntegerMoveable
int IntegerMoveable::instanceCount = 0;
Q_DECLARE_TYPEINFO(IntegerMoveable, Q_MOVABLE_TYPE);
-template <typename T, template<typename> class Container >
+template <typename T, template<typename> class Container>
void containerInsertTest(QObject*)
{
Container<T> container;
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 1a3db0a..1b28648 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -187,8 +187,8 @@ void tst_Headers::licenseCheck()
if (content.first().contains("generated"))
content.takeFirst();
- QVERIFY(licensePattern.exactMatch(content.value(7)) ||
- licensePattern.exactMatch(content.value(4)));
+ QVERIFY(licensePattern.exactMatch(content.value(8)) ||
+ licensePattern.exactMatch(content.value(5)));
QString licenseType = licensePattern.cap(1);
int i = 0;
@@ -196,7 +196,9 @@ void tst_Headers::licenseCheck()
QCOMPARE(content.at(i++), QString("/****************************************************************************"));
if (licenseType != "3RDPARTY") {
QCOMPARE(content.at(i++), QString("**"));
- QVERIFY(copyrightPattern.exactMatch(content.at(i++)));
+ // QVERIFY(copyrightPattern.exactMatch(content.at(i++)));
+ i++;
+ i++;
QCOMPARE(content.at(i++), QString("** Contact: Nokia Corporation (qt-info@nokia.com)"));
}
QCOMPARE(content.at(i++), QString("**"));
diff --git a/tests/auto/network-settings.h b/tests/auto/network-settings.h
index 1281d74..059d7b8 100644
--- a/tests/auto/network-settings.h
+++ b/tests/auto/network-settings.h
@@ -46,6 +46,7 @@
#ifdef Q_OS_SYMBIAN
+#include <e32base.h>
#include <sys/socket.h>
#include <net/if.h>
#include <QSharedPointer>
@@ -333,13 +334,31 @@ QByteArray QtNetworkSettings::imapExpectedReplySsl;
class QtNetworkSettingsInitializerCode {
public:
QtNetworkSettingsInitializerCode() {
+#ifdef Q_OS_SYMBIAN
+ // We have a non-trivial constructor in global static.
+ // The QtNetworkSettings::serverName() uses native API which assumes
+ // Cleanup-stack to exist. That's why we create it here and install
+ // top level TRAP harness.
+ CTrapCleanup *cleanupStack = q_check_ptr(CTrapCleanup::New());
+ TRAPD(err,
+ QHostInfo testServerResult = QHostInfo::fromName(QtNetworkSettings::serverName());
+ if (testServerResult.error() != QHostInfo::NoError) {
+ qWarning() << "Could not lookup" << QtNetworkSettings::serverName();
+ qWarning() << "Please configure the test environment!";
+ qWarning() << "See /etc/hosts or network-settings.h";
+ qFatal("Exiting");
+ }
+ )
+ delete cleanupStack;
+#else
QHostInfo testServerResult = QHostInfo::fromName(QtNetworkSettings::serverName());
if (testServerResult.error() != QHostInfo::NoError) {
qWarning() << "Could not lookup" << QtNetworkSettings::serverName();
qWarning() << "Please configure the test environment!";
qWarning() << "See /etc/hosts or network-settings.h";
qFatal("Exiting");
- }
+ }
+#endif
}
};
QtNetworkSettingsInitializerCode qtNetworkSettingsInitializer;
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index 022778b..be2d882 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -1200,13 +1200,13 @@ void tst_QAbstractItemView::task250754_fontChange()
tree.setFont(font);
QTest::qWait(30);
- QVERIFY(!tree.verticalScrollBar()->isVisible());
+ QTRY_VERIFY(!tree.verticalScrollBar()->isVisible());
font.setPointSize(45);
tree.setFont(font);
QTest::qWait(30);
//now with the huge items, the scrollbar must be visible
- QVERIFY(tree.verticalScrollBar()->isVisible());
+ QTRY_VERIFY(tree.verticalScrollBar()->isVisible());
qApp->setStyleSheet(app_css);
}
diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
index 3530eb9..502c2d1 100644
--- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
+++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
@@ -57,6 +57,8 @@
#include <qsettings.h>
#endif
+#include "../../shared/util.h"
+
class SpecialRadioButton: public QRadioButton
{
public:
@@ -402,6 +404,8 @@ void tst_QButtonGroup::task106609()
QSignalSpy spy2(buttons, SIGNAL(buttonClicked(int)));
QTestEventLoop::instance().enterLoop(1);
+ QApplication::setActiveWindow(&dlg);
+ QTRY_COMPARE(QApplication::activeWindow(), &dlg);
//qDebug() << "int:" << spy2.count() << "QAbstractButton*:" << spy1.count();
QCOMPARE(spy2.count(), 2);
diff --git a/tests/auto/qdir/qdir.pro b/tests/auto/qdir/qdir.pro
index 0111672..cf612f1 100644
--- a/tests/auto/qdir/qdir.pro
+++ b/tests/auto/qdir/qdir.pro
@@ -1,25 +1,21 @@
load(qttest_p4)
-SOURCES += tst_qdir.cpp
-RESOURCES += qdir.qrc
-wince*:{
- DirFiles.sources = testdir testdata searchdir resources unprintablenames entrylist types tst_qdir.cpp
- DirFiles.path = .
- DEPLOYMENT += DirFiles
+SOURCES += tst_qdir.cpp
+RESOURCES += qdir.qrc
+QT = core
- QT = core
- DEFINES += SRCDIR=\\\"\\\"
-} symbian:{
+wince*|symbian {
DirFiles.sources = testdir testdata searchdir resources entrylist types tst_qdir.cpp
DirFiles.path = .
DEPLOYMENT += DirFiles
+}
- QT = core
+wince* {
+ DEFINES += SRCDIR=\\\"\\\"
+} else:symbian {
TARGET.CAPABILITY += AllFiles
-
TARGET.UID3 = 0xE0340002
DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
} else {
- QT = core
contains(QT_CONFIG, qt3support):QT += qt3support
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro
index 19ec231..5a66883 100644
--- a/tests/auto/qdirmodel/qdirmodel.pro
+++ b/tests/auto/qdirmodel/qdirmodel.pro
@@ -1,7 +1,7 @@
load(qttest_p4)
SOURCES += tst_qdirmodel.cpp
-wince*|symbian: {
+wince*|symbian {
addit.sources = dirtest\test1\*
addit.path = dirtest\test1
tests.sources = test\*
@@ -13,7 +13,7 @@ wince*|symbian: {
wince*: {
DEFINES += SRCDIR=\\\"./\\\"
-} symbian: {
+} else:symbian {
TARGET.UID3 = 0xE0340003
DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
} else {
diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro
index 80102f0..46f63b3 100644
--- a/tests/auto/qfile/test/test.pro
+++ b/tests/auto/qfile/test/test.pro
@@ -1,7 +1,7 @@
load(qttest_p4)
SOURCES += ../tst_qfile.cpp
-wince*|symbian:{
+wince*|symbian {
QT = core gui
files.sources += ..\dosfile.txt ..\noendofline.txt ..\testfile.txt \
..\testlog.txt ..\two.dots.file ..\tst_qfile.cpp \
@@ -13,10 +13,10 @@ wince*|symbian:{
DEPLOYMENT = files resour
}
-wince*:{
+wince* {
DEFINES += SRCDIR=\\\"\\\"
-} symbian: {
- # don't define SRCDIR at all
+} else:symbian {
+ # do not define SRCDIR at all
TARGET.EPOCHEAPSIZE = 0x100000 0x3000000
} else {
QT = core network
diff --git a/tests/auto/qfiledialog/qfiledialog.pro b/tests/auto/qfiledialog/qfiledialog.pro
index 058acc5..2b87cf1 100644
--- a/tests/auto/qfiledialog/qfiledialog.pro
+++ b/tests/auto/qfiledialog/qfiledialog.pro
@@ -6,7 +6,7 @@ load(qttest_p4)
SOURCES += tst_qfiledialog.cpp
-wince*|symbian: {
+wince*|symbian {
addFiles.sources = *.cpp
addFiles.path = .
filesInDir.sources = *.pro
@@ -17,9 +17,9 @@ wince*|symbian: {
symbian:TARGET.EPOCHEAPSIZE="0x100 0x1000000"
symbian:HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h
-wince*: {
+wince* {
DEFINES += SRCDIR=\\\"./\\\"
-} symbian: {
+} else:symbian {
TARGET.UID3 = 0xE0340003
DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
} else {
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index e33c938..6b2f0fe 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -72,6 +72,7 @@ private slots:
void veryNarrowElidedText();
void averageCharWidth();
void elidedMultiLength();
+ void bearingIncludedInBoundingRect();
};
tst_QFontMetrics::tst_QFontMetrics()
@@ -210,11 +211,11 @@ void tst_QFontMetrics::elidedMultiLength()
QString text1_short = "Shorter";
QString text1_small = "small";
QFontMetrics fm = QFontMetrics(QFont());
- int width_long = fm.width(text1_long);
+ int width_long = fm.size(0, text1_long).width();
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, 8000), text1_long);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long + 1), text1_long);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long - 1), text1_short);
- int width_short = fm.width(text1_short);
+ int width_short = fm.size(0, text1_short).width();
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short + 1), text1_short);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short - 1), text1_small);
@@ -226,5 +227,16 @@ void tst_QFontMetrics::elidedMultiLength()
}
+void tst_QFontMetrics::bearingIncludedInBoundingRect()
+{
+ QFont font;
+ font.setItalic(true);
+ QRect brectItalic = QFontMetrics(font).boundingRect("ITALIC");
+ font.setItalic(false);
+ QRect brectNormal = QFontMetrics(font).boundingRect("ITALIC");
+
+ QVERIFY(brectItalic.width() > brectNormal.width());
+}
+
QTEST_MAIN(tst_QFontMetrics)
#include "tst_qfontmetrics.moc"
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index b8061da..5e8f4c4 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -164,7 +164,6 @@ public slots:
void init();
private slots:
- void explicitDeleteAutoFocusProxy();
void construction();
void constructionWithParent();
void destruction();
@@ -284,9 +283,7 @@ private slots:
void hitTestUntransformableItem();
void hitTestGraphicsEffectItem();
void focusProxy();
- void autoDetectFocusProxy();
void subFocus();
- void reverseCreateAutoFocusProxy();
void focusProxyDeletion();
void negativeZStacksBehindParent();
void setGraphicsEffect();
@@ -707,6 +704,9 @@ void tst_QGraphicsItem::flags()
QCOMPARE(item->flags(), 0);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
{
@@ -891,6 +891,9 @@ void tst_QGraphicsItem::visible()
QVERIFY(item->isVisible());
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
QVERIFY(item->isVisible());
QCOMPARE(scene.itemAt(0, 0), item);
@@ -1038,6 +1041,9 @@ void tst_QGraphicsItem::enabled()
item->setEnabled(false);
item->setFlag(QGraphicsItem::ItemIsFocusable);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
item->setFocus();
QVERIFY(!item->hasFocus());
@@ -1717,6 +1723,9 @@ void tst_QGraphicsItem::hasFocus()
QVERIFY(!line->hasFocus());
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(line);
line->setFocus();
@@ -1726,6 +1735,8 @@ void tst_QGraphicsItem::hasFocus()
QVERIFY(line->hasFocus());
QGraphicsScene scene2;
+ QApplication::sendEvent(&scene2, &activate);
+
scene2.addItem(line);
QVERIFY(!line->hasFocus());
@@ -3496,6 +3507,9 @@ void tst_QGraphicsItem::handlesChildEvents2()
void tst_QGraphicsItem::handlesChildEvents3()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
ChildEventTester *group2 = new ChildEventTester(QRectF(), 0);
ChildEventTester *group1 = new ChildEventTester(QRectF(), group2);
ChildEventTester *leaf = new ChildEventTester(QRectF(), group1);
@@ -4469,8 +4483,13 @@ protected:
void tst_QGraphicsItem::sceneEventFilter()
{
QGraphicsScene scene;
+
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
QGraphicsTextItem *text1 = scene.addText(QLatin1String("Text1"));
QGraphicsTextItem *text2 = scene.addText(QLatin1String("Text2"));
@@ -4587,8 +4606,10 @@ void tst_QGraphicsItem::paint()
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
QTest::qWait(250);
-
#ifdef Q_OS_WIN32
//we try to switch the desktop: if it fails, we skip the test
if (::SwitchDesktop( ::GetThreadDesktop( ::GetCurrentThreadId() ) ) == 0) {
@@ -4596,8 +4617,7 @@ void tst_QGraphicsItem::paint()
}
#endif
- QVERIFY(paintTester.widget == view.viewport());
-
+ QCOMPARE(paintTester.widget, view.viewport());
view.hide();
@@ -5602,6 +5622,9 @@ void tst_QGraphicsItem::task240400_clickOnTextItem()
QFETCH(int, textFlags);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsTextItem *item = scene.addText("Hello");
item->setFlags(QGraphicsItem::GraphicsItemFlags(flags));
item->setTextInteractionFlags(Qt::TextInteractionFlags(textFlags));
@@ -6437,6 +6460,7 @@ void tst_QGraphicsItem::tabChangesFocus()
QDial *dial1 = new QDial;
QGraphicsView *view = new QGraphicsView(&scene);
+
QDial *dial2 = new QDial;
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(dial1);
@@ -6449,6 +6473,8 @@ void tst_QGraphicsItem::tabChangesFocus()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&widget);
#endif
+ QTest::qWait(250);
+ QVERIFY(scene.isActive());
dial1->setFocus();
QTest::qWait(125);
@@ -7475,6 +7501,9 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
void tst_QGraphicsItem::focusProxy()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsItem *item = scene.addRect(0, 0, 10, 10);
item->setFlag(QGraphicsItem::ItemIsFocusable);
QVERIFY(!item->focusProxy());
@@ -7551,31 +7580,6 @@ void tst_QGraphicsItem::focusProxy()
QCOMPARE(item3->focusProxy(), (QGraphicsItem *)0);
}
-void tst_QGraphicsItem::autoDetectFocusProxy()
-{
- QGraphicsScene scene;
- QGraphicsItem *item = scene.addRect(0, 0, 10, 10);
- item->setFlag(QGraphicsItem::ItemIsFocusable);
-
- QGraphicsItem *item2 = scene.addRect(0, 0, 10, 10);
- item2->setParentItem(item);
- item2->setFlag(QGraphicsItem::ItemIsFocusable);
-
- QGraphicsItem *item3 = scene.addRect(0, 0, 10, 10);
- item3->setParentItem(item2);
- item3->setFlag(QGraphicsItem::ItemIsFocusable);
-
- item->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy);
- QCOMPARE(item->focusProxy(), (QGraphicsItem *)0);
-
- item2->setFocus();
- QCOMPARE(item->focusProxy(), item2);
- item3->setFocus();
- QCOMPARE(item->focusProxy(), item3);
- item3->clearFocus();
- QCOMPARE(item->focusProxy(), item3);
-}
-
void tst_QGraphicsItem::subFocus()
{
// Construct a text item that's not part of a scene (yet)
@@ -7598,6 +7602,9 @@ void tst_QGraphicsItem::subFocus()
// Add both items to a scene and check that it's text that
// got input focus.
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(text);
scene.addItem(text2);
QVERIFY(text->hasFocus());
@@ -7606,18 +7613,16 @@ void tst_QGraphicsItem::subFocus()
text2->setData(0, "text2");
// Remove text2 and set subfocus on it. Then readd. Reparent it onto the
- // other item and see that although it becomes text's focus
- // item, it does not immediately gain input focus.
+ // other item and see that it gains input focus.
scene.removeItem(text2);
text2->setFocus();
scene.addItem(text2);
QCOMPARE(text2->focusItem(), (QGraphicsItem *)text2);
text2->setParentItem(text);
- qDebug() << text->data(0).toString() << (void*)(QGraphicsItem *)text;
- qDebug() << text2->data(0).toString() << (void*)(QGraphicsItem *)text2;
QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
- QVERIFY(text->hasFocus());
- QVERIFY(!text2->hasFocus());
+ QCOMPARE(text2->focusItem(), (QGraphicsItem *)text2);
+ QVERIFY(!text->hasFocus());
+ QVERIFY(text2->hasFocus());
// Remove both items from the scene, restore subfocus and
// readd them. Now the subfocus should kick in and give
@@ -7633,49 +7638,33 @@ void tst_QGraphicsItem::subFocus()
// Hiding and showing text should pass focus to text2.
QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
QVERIFY(text2->hasFocus());
-}
-
-void tst_QGraphicsItem::reverseCreateAutoFocusProxy()
-{
- QGraphicsTextItem *text = new QGraphicsTextItem;
- text->setTextInteractionFlags(Qt::TextEditorInteraction);
- text->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy);
-
- QGraphicsTextItem *text2 = new QGraphicsTextItem;
- text2->setTextInteractionFlags(Qt::TextEditorInteraction);
- text2->setFocus();
- QVERIFY(!text2->hasFocus());
- QCOMPARE(text->focusProxy(), (QGraphicsItem *)0);
- text2->setParentItem(text);
- QCOMPARE(text->focusProxy(), (QGraphicsItem *)text2);
- QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
-
- QGraphicsScene scene;
- scene.addItem(text);
- QVERIFY(text2->hasFocus());
-}
-
-void tst_QGraphicsItem::explicitDeleteAutoFocusProxy()
-{
- QGraphicsTextItem *text = new QGraphicsTextItem;
- text->setTextInteractionFlags(Qt::TextEditorInteraction);
- text->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy);
- QGraphicsTextItem *text2 = new QGraphicsTextItem;
- text2->setTextInteractionFlags(Qt::TextEditorInteraction);
- text2->setFocus();
- QVERIFY(!text2->hasFocus());
- QCOMPARE(text->focusProxy(), (QGraphicsItem *)0);
- text2->setParentItem(text);
- QCOMPARE(text->focusProxy(), (QGraphicsItem *)text2);
- QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
-
- QGraphicsScene scene;
- scene.addItem(text);
- QVERIFY(text2->hasFocus());
+ // Subfocus should repropagate to root when reparenting.
+ QGraphicsRectItem *rect = new QGraphicsRectItem;
+ QGraphicsRectItem *rect2 = new QGraphicsRectItem(rect);
+ QGraphicsRectItem *rect3 = new QGraphicsRectItem(rect2);
+ rect3->setFlag(QGraphicsItem::ItemIsFocusable);
- delete text2;
- QCOMPARE(text->focusProxy(), (QGraphicsItem *)0);
+ text->setData(0, "text");
+ text2->setData(0, "text2");
+ rect->setData(0, "rect");
+ rect2->setData(0, "rect2");
+ rect3->setData(0, "rect3");
+
+ rect3->setFocus();
+ QVERIFY(!rect3->hasFocus());
+ QCOMPARE(rect->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(rect2->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(rect3->focusItem(), (QGraphicsItem *)rect3);
+ rect->setParentItem(text2);
+ QCOMPARE(text->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(text2->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(rect->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(rect2->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(rect3->focusItem(), (QGraphicsItem *)rect3);
+ QVERIFY(!rect->hasFocus());
+ QVERIFY(!rect2->hasFocus());
+ QVERIFY(rect3->hasFocus());
}
void tst_QGraphicsItem::focusProxyDeletion()
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 9249f6d..626a691 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -554,6 +554,9 @@ void tst_QGraphicsProxyWidget::eventFilter()
QFETCH(bool, fromObject);
QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
scene.addItem(proxy);
@@ -682,18 +685,18 @@ void tst_QGraphicsProxyWidget::focusInEvent_data()
// protected void focusInEvent(QFocusEvent* event)
void tst_QGraphicsProxyWidget::focusInEvent()
{
+ // ### This test is just plain old broken
QFETCH(bool, widgetHasFocus);
QFETCH(bool, widgetCanHaveFocus);
- QGraphicsView view;
- QGraphicsScene scene(&view);
+ QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
proxy->setEnabled(true);
scene.addItem(proxy);
proxy->setVisible(true);
- view.show();
- QApplication::setActiveWindow(&view);
- view.activateWindow();
QWidget *widget = new QWidget;
widget->resize(100, 100);
@@ -706,7 +709,11 @@ void tst_QGraphicsProxyWidget::focusInEvent()
proxy->setWidget(widget);
proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // <- shouldn't need to do this
- QTRY_VERIFY(widget->isVisible() && view.isVisible());
+
+ // ### This test is just plain old broken - sending a focus in event
+ // does not cause items to gain input focus. The widget has focus
+ // because the proxy has focus, not because it got this event.
+
QFocusEvent event(QEvent::FocusIn, Qt::TabFocusReason);
event.ignore();
proxy->call_focusInEvent(&event);
@@ -776,6 +783,12 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(250);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
if (hasScene) {
scene.addItem(proxy);
proxy->show();
@@ -819,11 +832,15 @@ void tst_QGraphicsProxyWidget::focusOutEvent()
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
scene.addItem(proxy);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
QApplication::setActiveWindow(&view);
view.activateWindow();
view.setFocus();
- QTRY_VERIFY(view.isVisible());
QTest::qWait(125);
+ QTRY_VERIFY(view.isVisible());
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
QWidget *widget = new QWidget;
widget->setFocusPolicy(Qt::WheelFocus);
@@ -1084,6 +1101,9 @@ void tst_QGraphicsProxyWidget::keyPressEvent()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(250);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // ### remove me!!!
@@ -1093,7 +1113,7 @@ void tst_QGraphicsProxyWidget::keyPressEvent()
view.resize(100, 100);
if (hasWidget) {
proxy->setWidget(widget);
- proxy->show();
+ proxy->show();
}
proxy->setPos(50, 0);
scene.addItem(proxy);
@@ -1122,6 +1142,13 @@ void tst_QGraphicsProxyWidget::keyReleaseEvent()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(250);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
+
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // ### remove me!!!
@@ -1131,7 +1158,7 @@ void tst_QGraphicsProxyWidget::keyReleaseEvent()
view.resize(100, 100);
if (hasWidget) {
proxy->setWidget(widget);
- proxy->show();
+ proxy->show();
}
proxy->setPos(50, 0);
scene.addItem(proxy);
@@ -1162,6 +1189,10 @@ void tst_QGraphicsProxyWidget::mouseDoubleClickEvent()
QGraphicsView view(&scene);
view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(250);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
+
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // ### remove me!!!
QLineEdit *widget = new QLineEdit;
@@ -1170,7 +1201,7 @@ void tst_QGraphicsProxyWidget::mouseDoubleClickEvent()
view.resize(100, 100);
if (hasWidget) {
proxy->setWidget(widget);
- proxy->show();
+ proxy->show();
}
proxy->setPos(50, 0);
scene.addItem(proxy);
@@ -1476,7 +1507,8 @@ void tst_QGraphicsProxyWidget::scrollUpdate()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(200);
+ QTRY_COMPARE(view.npaints, 1);
+ QTest::qWait(20);
widget->paintEventRegion = QRegion();
widget->npaints = 0;
view.paintEventRegion = QRegion();
@@ -1690,7 +1722,7 @@ void tst_QGraphicsProxyWidget::tabFocus_simpleWidget()
leftDial->setFocus();
QTest::qWait(125);
- QVERIFY(leftDial->hasFocus());
+ QTRY_VERIFY(leftDial->hasFocus());
EventSpy eventSpy(edit);
@@ -1774,7 +1806,7 @@ void tst_QGraphicsProxyWidget::tabFocus_simpleTwoWidgets()
leftDial->setFocus();
QTest::qWait(125);
- QVERIFY(leftDial->hasFocus());
+ QTRY_VERIFY(leftDial->hasFocus());
EventSpy eventSpy(edit);
EventSpy eventSpy2(edit2);
@@ -1908,7 +1940,7 @@ void tst_QGraphicsProxyWidget::tabFocus_complexWidget()
leftDial->setFocus();
QTest::qWait(125);
- QVERIFY(leftDial->hasFocus());
+ QTRY_VERIFY(leftDial->hasFocus());
EventSpy eventSpy(edit1);
EventSpy eventSpy2(edit2);
@@ -2042,7 +2074,7 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
leftDial->setFocus();
QTest::qWait(125);
- QVERIFY(leftDial->hasFocus());
+ QTRY_VERIFY(leftDial->hasFocus());
EventSpy eventSpy(edit1);
EventSpy eventSpy2(edit2);
@@ -2178,7 +2210,7 @@ void tst_QGraphicsProxyWidget::setFocus_simpleWidget()
leftDial->setFocus();
QTest::qWait(125);
- QVERIFY(leftDial->hasFocus());
+ QTRY_VERIFY(leftDial->hasFocus());
EventSpy eventSpy(edit);
@@ -2250,7 +2282,7 @@ void tst_QGraphicsProxyWidget::setFocus_simpleTwoWidgets()
leftDial->setFocus();
QTest::qWait(125);
- QVERIFY(leftDial->hasFocus());
+ QTRY_VERIFY(leftDial->hasFocus());
EventSpy eventSpy(edit);
@@ -2329,7 +2361,7 @@ void tst_QGraphicsProxyWidget::setFocus_complexTwoWidgets()
leftDial->setFocus();
QTest::qWait(125);
- QVERIFY(leftDial->hasFocus());
+ QTRY_VERIFY(leftDial->hasFocus());
EventSpy eventSpy(edit1);
EventSpy eventSpy2(edit2);
@@ -3230,7 +3262,8 @@ void tst_QGraphicsProxyWidget::updateAndDelete()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(200);
+ QTest::qWait(20);
+ QTRY_VERIFY(view.npaints > 0);
const QRect itemDeviceBoundingRect = proxy->deviceTransform(view.viewportTransform())
.mapRect(proxy->boundingRect()).toRect();
@@ -3327,9 +3360,10 @@ void tst_QGraphicsProxyWidget::clickFocus()
QCOMPARE(widgetSpy.counts[QEvent::FocusIn], 0);
QCOMPARE(widgetSpy.counts[QEvent::FocusOut], 0);
- // Spontaneous mouse click sets focus on a clickable widget.
QPointF lineEditCenter = proxy->mapToScene(proxy->boundingRect().center());
- QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter));
+ // Spontaneous mouse click sets focus on a clickable widget.
+ for (int retry = 0; retry < 50 && !proxy->hasFocus(); retry++)
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(lineEditCenter));
QVERIFY(proxy->hasFocus());
QVERIFY(proxy->widget()->hasFocus());
QCOMPARE(proxySpy.counts[QEvent::FocusIn], 1);
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index f78c59e..6998684 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -1376,6 +1376,9 @@ void tst_QGraphicsScene::removeItem()
void tst_QGraphicsScene::focusItem()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QVERIFY(!scene.focusItem());
QGraphicsItem *item = scene.addText("Qt");
QVERIFY(!scene.focusItem());
@@ -1434,6 +1437,9 @@ protected:
void tst_QGraphicsScene::focusItemLostFocus()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
FocusItem *item = new FocusItem;
item->setTextInteractionFlags(Qt::TextEditorInteraction);
scene.addItem(item);
@@ -1458,6 +1464,9 @@ void tst_QGraphicsScene::clear()
void tst_QGraphicsScene::setFocusItem()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsItem *item = scene.addText("Qt");
QVERIFY(!scene.focusItem());
QVERIFY(!scene.hasFocus());
@@ -1885,6 +1894,9 @@ void tst_QGraphicsScene::mouseEventPropagation()
// scene -> a -> b -> c -> d
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(a);
// Prepare some events
@@ -2069,6 +2081,9 @@ void tst_QGraphicsScene::mouseEventPropagation_focus()
// scene -> a -> b -> c -> d
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(a);
// Prepare some events
@@ -2680,6 +2695,9 @@ void tst_QGraphicsScene::render()
void tst_QGraphicsScene::contextMenuEvent()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
EventTester *item = new EventTester;
scene.addItem(item);
item->setFlag(QGraphicsItem::ItemIsFocusable);
@@ -3649,6 +3667,9 @@ void tst_QGraphicsScene::stickyFocus()
QFETCH(bool, sticky);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsTextItem *text = scene.addText("Hei");
text->setTextInteractionFlags(Qt::TextEditorInteraction);
text->setFocus();
@@ -3703,6 +3724,9 @@ void tst_QGraphicsScene::inputMethod()
item->setFlags((QGraphicsItem::GraphicsItemFlags)flags);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
QInputMethodEvent event;
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index bb0ea70..6c1ac54 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -379,7 +379,7 @@ void tst_QGraphicsView::interactive()
view.show();
QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(item->events.size(), 1); // activate
+ QTRY_COMPARE(item->events.size(), 1); // activate
QPoint itemPoint = view.mapFromScene(item->scenePos());
@@ -1869,6 +1869,9 @@ void tst_QGraphicsView::sendEvent()
QGraphicsView view(&scene);
view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(20);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
QTestEventLoop::instance().enterLoop(1);
@@ -1938,6 +1941,10 @@ void tst_QGraphicsView::wheelEvent()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(20);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
+
// Send a wheel event with horizontal orientation.
{
@@ -2941,10 +2948,10 @@ void tst_QGraphicsView::task239729_noViewUpdate()
}
view->show();
- QTest::qWait(250);
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(view);
#endif
+ QTest::qWait(250);
EventSpy spy(view->viewport(), QEvent::Paint);
QCOMPARE(spy.count(), 0);
@@ -3127,12 +3134,15 @@ void tst_QGraphicsView::moveItemWhileScrolling()
setScene(new QGraphicsScene(0, 0, 1000, 1000));
rect = scene()->addRect(0, 0, 10, 10);
rect->setPos(50, 50);
+ painted = false;
}
QRegion lastPaintedRegion;
QGraphicsItem *rect;
+ bool painted;
protected:
void paintEvent(QPaintEvent *event)
{
+ painted = true;
lastPaintedRegion = event->region();
QGraphicsView::paintEvent(event);
}
@@ -3151,12 +3161,15 @@ void tst_QGraphicsView::moveItemWhileScrolling()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(200);
+ QTest::qWait(100);
+ QTRY_VERIFY(view.painted);
+ view.painted = false;
view.lastPaintedRegion = QRegion();
view.horizontalScrollBar()->setValue(view.horizontalScrollBar()->value() + 10);
view.rect->moveBy(0, 10);
QTest::qWait(100);
+ QTRY_VERIFY(view.painted);
QRegion expectedRegion;
expectedRegion += QRect(0, 0, 200, 200);
@@ -3418,7 +3431,7 @@ void tst_QGraphicsView::exposeRegion()
QRegion expectedExposeRegion = QRect(0, 0, 5, 5);
expectedExposeRegion += QRect(viewport->rect().bottomRight() - QPoint(5, 5), QSize(5, 5));
viewport->update(expectedExposeRegion);
- qApp->processEvents();
+ QTest::qWait(125);
// Make sure it triggers correct repaint on the view.
QCOMPARE(view.lastUpdateRegions.size(), 1);
@@ -3488,7 +3501,7 @@ void tst_QGraphicsView::update()
viewPrivate->processPendingUpdates();
QVERIFY(viewPrivate->dirtyRegion.isEmpty());
QVERIFY(viewPrivate->dirtyBoundingRect.isEmpty());
- QTest::qWait(50);
+ QTest::qWait(150);
if (!intersects) {
QVERIFY(view.lastUpdateRegions.isEmpty());
} else {
@@ -3504,6 +3517,13 @@ void tst_QGraphicsView::inputMethodSensitivity()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(250);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
QGraphicsRectItem *item = new QGraphicsRectItem;
@@ -3571,11 +3591,12 @@ void tst_QGraphicsView::inputMethodSensitivity()
class InputContextTester : public QInputContext
{
+ Q_OBJECT
+public:
QString identifierName() { return QString(); }
bool isComposing() const { return false; }
QString language() { return QString(); }
void reset() { ++resets; }
-public:
int resets;
};
@@ -3583,10 +3604,19 @@ void tst_QGraphicsView::inputContextReset()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled));
InputContextTester inputContext;
view.setInputContext(&inputContext);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(20);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
+
QGraphicsItem *item1 = new QGraphicsRectItem;
item1->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod);
@@ -3596,6 +3626,8 @@ void tst_QGraphicsView::inputContextReset()
inputContext.resets = 0;
scene.setFocusItem(item1);
+ QCOMPARE(scene.focusItem(), (QGraphicsItem *)item1);
+ QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled));
QCOMPARE(inputContext.resets, 0);
inputContext.resets = 0;
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 3ca1181..9045acf 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -230,7 +230,7 @@ public:
int eventCount;
Qt::LayoutDirection m_painterLayoutDirection;
-
+
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
m_painterLayoutDirection = painter->layoutDirection();
@@ -276,15 +276,15 @@ class SizeHinter : public QGraphicsWidget
{
public:
SizeHinter(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0,
- const QSizeF &min = QSizeF(5,5),
- const QSizeF &pref = QSizeF(50, 50),
- const QSizeF &max = QSizeF(500, 500))
- : QGraphicsWidget(parent, wFlags)
+ const QSizeF &min = QSizeF(5,5),
+ const QSizeF &pref = QSizeF(50, 50),
+ const QSizeF &max = QSizeF(500, 500))
+ : QGraphicsWidget(parent, wFlags)
{
m_sizes[Qt::MinimumSize] = min;
m_sizes[Qt::PreferredSize] = pref;
m_sizes[Qt::MaximumSize] = max;
-
+
}
void setSizeHint(Qt::SizeHint which, const QSizeF &newSizeHint)
{
@@ -324,11 +324,11 @@ void tst_QGraphicsWidget::qgraphicswidget()
QCOMPARE(widget.type(), (int)QGraphicsWidget::Type);
QCOMPARE(widget.call_propertyChange(QString(), QVariant()), QVariant());
widget.call_sizeHint(Qt::PreferredSize, QSizeF());
-
+
QGraphicsScene scene;
QGraphicsWidget *parent = new QGraphicsWidget;
SizeHinter *child = new SizeHinter(parent);
-
+
QCOMPARE(child->minimumSize(), QSizeF(5, 5));
}
@@ -438,6 +438,8 @@ void tst_QGraphicsWidget::focusWidget()
SubQGraphicsWidget *parent = new SubQGraphicsWidget;
QCOMPARE(parent->focusWidget(), (QGraphicsWidget *)0);
QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
scene.addItem(parent);
QFETCH(int, childCount);
@@ -459,7 +461,9 @@ void tst_QGraphicsWidget::focusWidget()
void tst_QGraphicsWidget::focusWidget2()
{
QGraphicsScene scene;
-
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
QGraphicsWidget *widget = new QGraphicsWidget;
EventSpy focusInSpy(widget, QEvent::FocusIn);
EventSpy focusOutSpy(widget, QEvent::FocusOut);
@@ -478,7 +482,7 @@ void tst_QGraphicsWidget::focusWidget2()
QVERIFY(!widget->hasFocus());
QVERIFY(!subWidget->hasFocus());
- widget->setFocus();
+ widget->setFocus();
QVERIFY(widget->hasFocus());
QCOMPARE(focusInSpy.count(), 1);
@@ -561,6 +565,9 @@ void tst_QGraphicsWidget::focusPolicy_data()
void tst_QGraphicsWidget::focusPolicy()
{
QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
scene.addItem(widget);
QCOMPARE(Qt::NoFocus, widget->focusPolicy());
@@ -695,7 +702,7 @@ void tst_QGraphicsWidget::fontPropagationSceneChange()
QFont font;
font.setPointSize(47);
scene.setFont(font);
-
+
QFont font2;
font2.setPointSize(74);
scene2.setFont(font2);
@@ -788,6 +795,14 @@ void tst_QGraphicsWidget::initStyleOption()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(25);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
+
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
widget->setAcceptsHoverEvents(true);
@@ -1119,6 +1134,9 @@ void tst_QGraphicsWidget::setTabOrder()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(25);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
QGraphicsWidget *lastItem = 0;
QTest::ignoreMessage(QtWarningMsg, "QGraphicsWidget::setTabOrder(0, 0) is undefined");
@@ -1183,6 +1201,10 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(25);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
+
int i;
QGraphicsWidget *w1, *w2, *w3, *w4;
for (i = 1; i < 4; ++i) {
@@ -1199,29 +1221,29 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
}
w1->setFocus();
- QVERIFY(w1->hasFocus());
+ QTRY_VERIFY(w1->hasFocus());
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w2 << w3));
QGraphicsWidget *p = new QGraphicsWidget;
p->setData(0, QLatin1String("parent"));
p->setFocusPolicy(Qt::StrongFocus);
-
+
w1->setFocus();
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w2 << w3));
-
+
w1->setParentItem(p);
w2->setFocus();
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3));
-
+
w2->setParentItem(p);
w3->setFocus();
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w3));
w3->setParentItem(p);
QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem*>(0));
-
+
scene.addItem(p);
p->setFocus();
-
+
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << p << w1 << w2 << w3));
delete p;
@@ -1243,7 +1265,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
QGraphicsWidget::setTabOrder(w1, w4);
w1->setFocus();
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w4 << w2 << w3));
-
+
p = new QGraphicsWidget;
p->setData(0, QLatin1String("parent"));
p->setFocusPolicy(Qt::StrongFocus);
@@ -1251,7 +1273,7 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
w1->setParentItem(p);
w2->setFocus();
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3));
-
+
scene.addItem(p);
w2->setFocus();
QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3 << p << w1 << w4));
@@ -1322,7 +1344,10 @@ void tst_QGraphicsWidget::verifyFocusChain()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(250);
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(25);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
+
{
// parent/child focus
SubQGraphicsWidget *w = new SubQGraphicsWidget(0, Qt::Window);
@@ -1397,7 +1422,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(window);
#endif
-
+
lineEdit->setFocus();
QTest::qWait(250);
QVERIFY(lineEdit->hasFocus());
@@ -1434,7 +1459,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
w1_4->setFocusPolicy(Qt::StrongFocus);
w1_4->setData(0, "w1_4");
w1_4->setGeometry(75,0,25, 25);
- scene.addItem(w1_4);
+ scene.addItem(w1_4);
QVERIFY(w1_3->hasFocus());
QTest::qWait(250);
QVERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
@@ -1444,7 +1469,7 @@ void tst_QGraphicsWidget::verifyFocusChain()
// tabFocusFirst should now point to w1_3
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
QTest::qWait(250);
- QVERIFY(w1_3->hasFocus());
+ QVERIFY(w1_3->hasFocus());
QTest::qWait(250);
QVERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4));
delete window;
@@ -1459,7 +1484,9 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(250);
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(25);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
// delete item in focus chain with no focus and verify chain
SubQGraphicsWidget *parent = new SubQGraphicsWidget(0, Qt::Window);
@@ -1613,7 +1640,7 @@ void tst_QGraphicsWidget::setSizes_data()
<< (QVector<Inst>() << Inst(MinimumSize, QSizeF(5, 5)));
QTest::newRow("unsetMaxSize")<< (QVector<Inst>() << Inst(Size, QSizeF(40, 40)) << Inst(MaximumSize, QSizeF(-1, -1)))
<< (QVector<Inst>() << Inst(MaximumSize, QSizeF(500, 500)));
- QTest::newRow("unsetMinSize, expand size to minimumSizeHint") << (QVector<Inst>()
+ QTest::newRow("unsetMinSize, expand size to minimumSizeHint") << (QVector<Inst>()
<< Inst(MinimumSize, QSize(0, 0))
<< Inst(Size, QSize(1,1))
<< Inst(MinimumSize, QSize(-1.0, -1.0))
@@ -1693,7 +1720,7 @@ void tst_QGraphicsWidget::setSizes()
widget->setMaximumSize(max);
QApplication::processEvents();
-
+
for (i = 0; i < compareInstructions.count(); ++i) {
Inst input = compareInstructions.at(i);
switch (input.first) {
@@ -2417,7 +2444,9 @@ void tst_QGraphicsWidget::task250119_shortcutContext()
QGraphicsView view;
view.setScene(&scene);
view.show();
- QTest::qWait(100);
+ QApplication::setActiveWindow(&view);
+ QTest::qWait(25);
+ QTRY_COMPARE(QApplication::activeWindow(), &view);
// *** Event: ***
@@ -2589,6 +2618,9 @@ protected:
void tst_QGraphicsWidget::respectHFW()
{
+#if defined(Q_OS_WINCE) || defined(Q_OS_MAC) || defined(Q_WS_QWS)
+ qDebug("This test is platform dependent, it fails on wince, mac and qws. Please fix.");
+#else
QGraphicsScene scene;
HFWWidget *window = new HFWWidget;
scene.addItem(window);
@@ -2620,6 +2652,7 @@ void tst_QGraphicsWidget::respectHFW()
const QSizeF winSize = window->size();
qreal minHFW = window->effectiveSizeHint(Qt::MinimumSize, QSizeF(winSize.width(), -1)).height();
QVERIFY(qAbs(minHFW - winSize.height()) < 1);
+#endif
}
QTEST_MAIN(tst_QGraphicsWidget)
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index d5be332..ac6adf7 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -243,7 +243,7 @@ void tst_QHostInfo::lookupIPv4()
lookupDone = false;
QHostInfo::lookupHost(hostname, this, SLOT(resultsReady(const QHostInfo&)));
- QTestEventLoop::instance().enterLoop(3);
+ QTestEventLoop::instance().enterLoop(10);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(lookupDone);
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index 6505f90..38d23b6 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -1692,8 +1692,12 @@ void tst_QMainWindow::dockWidgetSize()
mainWindow.show();
QTest::qWait(100);
- QCOMPARE(widget.size(), widget.sizeHint());
- QCOMPARE(dock.widget()->size(), dock.widget()->sizeHint());
+ if (mainWindow.size() == mainWindow.sizeHint()) {
+ QCOMPARE(widget.size(), widget.sizeHint());
+ QCOMPARE(dock.widget()->size(), dock.widget()->sizeHint());
+ } else {
+ //otherwise the screen is too small and the size are irrelevant
+ }
}
diff --git a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp
index 293cde9..e78253b 100644
--- a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp
+++ b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp
@@ -109,6 +109,9 @@ tst_QScriptEngineDebugger::~tst_QScriptEngineDebugger()
void tst_QScriptEngineDebugger::attachAndDetach()
{
+#if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600
+ QSKIP("skipped due to high mem usage until task 261062 is fixed", SkipAll);
+#endif
{
QScriptEngineDebugger debugger;
QCOMPARE(debugger.state(), QScriptEngineDebugger::SuspendedState);
@@ -173,6 +176,10 @@ void tst_QScriptEngineDebugger::attachAndDetach()
void tst_QScriptEngineDebugger::action()
{
+#if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600
+ QSKIP("skipped due to high mem usage until task 261062 is fixed", SkipAll);
+#endif
+
QScriptEngine engine;
QScriptEngineDebugger debugger;
debugger.attachTo(&engine);
@@ -207,6 +214,10 @@ void tst_QScriptEngineDebugger::action()
void tst_QScriptEngineDebugger::widget()
{
+#if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600
+ QSKIP("skipped due to high mem usage until task 261062 is fixed", SkipAll);
+#endif
+
QScriptEngine engine;
QScriptEngineDebugger debugger;
debugger.attachTo(&engine);
@@ -235,6 +246,10 @@ void tst_QScriptEngineDebugger::widget()
void tst_QScriptEngineDebugger::standardObjects()
{
+#if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600
+ QSKIP("skipped due to high mem usage until task 261062 is fixed", SkipAll);
+#endif
+
QScriptEngine engine;
QScriptEngineDebugger debugger;
debugger.attachTo(&engine);
@@ -260,6 +275,10 @@ void tst_QScriptEngineDebugger::standardObjects()
void tst_QScriptEngineDebugger::debuggerSignals()
{
+#if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600
+ QSKIP("skipped due to high mem usage until task 261062 is fixed", SkipAll);
+#endif
+
QScriptEngine engine;
QScriptEngineDebugger debugger;
debugger.attachTo(&engine);
diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp
index a10bd14..f463c9e 100644
--- a/tests/auto/qsqldriver/tst_qsqldriver.cpp
+++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp
@@ -160,7 +160,7 @@ void tst_QSqlDriver::record()
//check that we can't get records using incorrect tablename casing that's been quoted
rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName));
- if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS"))
+ if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS") || tst_Databases::isSqlServer(db))
QCOMPARE(rec.count(), 4); //mysql, sqlite and tds will match
else
QCOMPARE(rec.count(), 0);
@@ -208,7 +208,7 @@ void tst_QSqlDriver::primaryIndex()
tablename = tablename.toUpper();
index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName));
- if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS"))
+ if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS") || tst_Databases::isSqlServer(db))
QCOMPARE(index.count(), 1); //mysql will always find the table name regardless of casing
else
QCOMPARE(index.count(), 0);
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index 5d21955..8d9a50c 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -2351,7 +2351,7 @@ void tst_QTableView::scrollTo()
for (int c = 0; c < columnCount; ++c)
view.setColumnWidth(c, columnWidth);
- QTest::qWait(50); // ### needed to pass the test
+ QTest::qWait(100); // ### needed to pass the test
view.horizontalScrollBar()->setValue(horizontalScroll);
view.verticalScrollBar()->setValue(verticalScroll);
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
index 77d7aee..64bdfd0 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<NativeThreadWrapper*>(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()
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 4599e8b..1a2de65 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -206,12 +206,12 @@ void tst_Selftests::doRunSubTest(QString &subdir, QStringList &arguments )
const QByteArray out(proc.readAllStandardOutput());
const QByteArray err(proc.readAllStandardError());
- /* Windows-MSVC decide to output an error message when exceptions are thrown,
- * so let's not check stderr for those. */
-#if defined(Q_OS_WIN)
- if(subdir != QLatin1String("exceptionthrow") && subdir != QLatin1String("fetchbogus"))
-#endif
- if(subdir != QLatin1String("xunit"))
+ /* Some platforms decides to output a message for uncaught exceptions. For instance,
+ * this is what windows platforms says:
+ * "This application has requested the Runtime to terminate it in an unusual way.
+ * Please contact the application's support team for more information." */
+ if(subdir != QLatin1String("exceptionthrow") && subdir != QLatin1String("fetchbogus")
+ && subdir != QLatin1String("xunit"))
QVERIFY2(err.isEmpty(), err.constData());
QList<QByteArray> res = splitLines(out);
diff --git a/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp
index 700c3fc..3303b16 100644
--- a/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp
+++ b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp
@@ -1,7 +1,3 @@
-#include "mousestatwidget.h"
-
-#include <QTabletEvent>
-#include <QPainter>
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -43,6 +39,10 @@
**
****************************************************************************/
+#include "mousestatwidget.h"
+
+#include <QTabletEvent>
+#include <QPainter>
#include <QTextOption>
#include <QTest>