summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:24:34 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:25:04 +0100
commitd456f87ece0323982b7601047712545ab95426ad (patch)
tree46b90468b01144615f280620d73763fc189d25ac /tests/auto/widgets
parentcc2938b5b6aa07210b04bd48ad8a2830701a06e5 (diff)
parent4fc070a4192d5b914b6f814a8dcab3f552d9abac (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp38
-rw-r--r--tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp8
-rw-r--r--tests/auto/widgets/util/qundostack/tst_qundostack.cpp8
3 files changed, 21 insertions, 33 deletions
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 6488b38c9f..cd8bce173b 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -201,32 +201,20 @@ void tst_QWidget_window::tst_show_resize_hide_show()
// QCoreApplication::processEvents(QEventLoop::AllEvents, 1000);
}
-class TestWidget : public QWidget
+class PaintTestWidget : public QWidget
{
public:
- int m_first, m_next;
- bool paintEventReceived;
+ int paintEventCount;
- void reset(){ m_first = m_next = 0; paintEventReceived = false; }
- bool event(QEvent *event)
+ explicit PaintTestWidget(QWidget *parent = Q_NULLPTR)
+ : QWidget(parent)
+ , paintEventCount(0)
+ {}
+
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE
{
- switch (event->type()) {
- case QEvent::WindowActivate:
- case QEvent::WindowDeactivate:
- case QEvent::Hide:
- case QEvent::Show:
- if (m_first)
- m_next = event->type();
- else
- m_first = event->type();
- break;
- case QEvent::Paint:
- paintEventReceived = true;
- break;
- default:
- break;
- }
- return QWidget::event(event);
+ ++paintEventCount;
+ QWidget::paintEvent(event);
}
};
@@ -361,15 +349,15 @@ void tst_QWidget_window::tst_showWithoutActivating()
void tst_QWidget_window::tst_paintEventOnSecondShow()
{
- TestWidget w;
+ PaintTestWidget w;
w.show();
w.hide();
- w.reset();
+ w.paintEventCount = 0;
w.show();
QVERIFY(QTest::qWaitForWindowExposed(&w));
QApplication::processEvents();
- QTRY_VERIFY(w.paintEventReceived);
+ QTRY_VERIFY(w.paintEventCount > 0);
}
#ifndef QT_NO_DRAGANDDROP
diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
index b7fc382bef..02ed912323 100644
--- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
@@ -619,13 +619,13 @@ void tst_QUndoGroup::commandTextFormat()
const QString tsFile = QFINDTESTDATA("testdata/qundogroup.ts");
QVERIFY(!tsFile.isEmpty());
- QVERIFY(!QProcess::execute(binDir + "/lrelease " + tsFile));
+ QFile::remove("qundogroup.qm"); // Avoid confusion by strays.
+ QVERIFY(!QProcess::execute(binDir + "/lrelease -silent " + tsFile + " -qm qundogroup.qm"));
QTranslator translator;
- const QString qmFile = QFINDTESTDATA("testdata/qundogroup.qm");
- QVERIFY(!qmFile.isEmpty());
- QVERIFY(translator.load(qmFile));
+ QVERIFY(translator.load("qundogroup.qm"));
+ QFile::remove("qundogroup.qm");
qApp->installTranslator(&translator);
QUndoGroup group;
diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
index 90f29f5eb9..f21780c2c2 100644
--- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
+++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
@@ -2963,12 +2963,12 @@ void tst_QUndoStack::commandTextFormat()
const QString tsFile = QFINDTESTDATA("testdata/qundostack.ts");
QVERIFY(!tsFile.isEmpty());
- QVERIFY(!QProcess::execute(binDir + "/lrelease " + tsFile));
+ QFile::remove("qundostack.qm"); // Avoid confusion by strays.
+ QVERIFY(!QProcess::execute(binDir + "/lrelease -silent " + tsFile + " -qm qundostack.qm"));
QTranslator translator;
- const QString qmFile = QFINDTESTDATA("testdata/qundostack.qm");
- QVERIFY(!qmFile.isEmpty());
- QVERIFY(translator.load(qmFile));
+ QVERIFY(translator.load("qundostack.qm"));
+ QFile::remove("qundostack.qm");
qApp->installTranslator(&translator);
QUndoStack stack;