summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp101
2 files changed, 102 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 13e786cd20..edb6488eaa 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -1564,7 +1564,7 @@ public slots:
void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); }
-#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && (__clang_major__ * 100) + __clang_minor__) < 304)
+#if defined(Q_MOC_RUN) || (defined(Q_COMPILER_AUTO_TYPE) && !(defined(Q_CC_CLANG) && Q_CC_CLANG < 304))
// There is no Q_COMPILER_>> but if compiler support auto, it should also support >>
void performSomething(QVector<QList<QString>> e = QVector<QList<QString>>(8 < 1),
QHash<int, QVector<QString>> h = QHash<int, QVector<QString>>())
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 c6c7464194..36791293ab 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -95,6 +95,8 @@ private slots:
void tst_updateWinId_QTBUG40681();
void tst_recreateWindow_QTBUG40817();
+ void tst_resize_count();
+ void tst_move_count();
};
void tst_QWidget_window::initTestCase()
@@ -660,6 +662,105 @@ void tst_QWidget_window::tst_recreateWindow_QTBUG40817()
tab.setCurrentIndex(1);
}
+class ResizeWidget : public QWidget
+{
+Q_OBJECT
+public:
+ ResizeWidget(QWidget *parent = 0)
+ : QWidget(parent)
+ , resizeCount(0)
+ { }
+
+ int resizeCount;
+
+protected:
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
+ {
+ resizeCount++;
+ }
+};
+
+void tst_QWidget_window::tst_resize_count()
+{
+ {
+ ResizeWidget resize;
+ resize.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&resize));
+ QCOMPARE(resize.resizeCount, 1);
+ resize.resizeCount = 0;
+ QSize size = resize.size();
+ size.rwidth() += 10;
+ resize.resize(size);
+ QGuiApplication::sync();
+ QTRY_COMPARE(resize.resizeCount, 1);
+
+ resize.resizeCount = 0;
+
+ ResizeWidget child(&resize);
+ child.resize(200,200);
+ child.winId();
+ child.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&child));
+ QGuiApplication::sync();
+ QTRY_COMPARE(child.resizeCount, 1);
+ child.resizeCount = 0;
+ size = child.size();
+ size.rwidth() += 10;
+ child.resize(size);
+ QGuiApplication::sync();
+ QCOMPARE(resize.resizeCount, 0);
+ QCOMPARE(child.resizeCount, 1);
+ }
+ {
+ ResizeWidget parent;
+ ResizeWidget child(&parent);
+ child.resize(200,200);
+ child.winId();
+ parent.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&parent));
+ parent.resizeCount = 0;
+ QGuiApplication::sync();
+ QTRY_COMPARE(child.resizeCount, 1);
+ child.resizeCount = 0;
+ QSize size = child.size();
+ size.rwidth() += 10;
+ child.resize(size);
+ QGuiApplication::sync();
+ QCOMPARE(parent.resizeCount, 0);
+ QCOMPARE(child.resizeCount, 1);
+ }
+
+}
+
+class MoveWidget : public QWidget
+{
+Q_OBJECT
+public:
+ MoveWidget(QWidget *parent = 0)
+ : QWidget(parent)
+ , moveCount(0)
+ { }
+
+ void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE
+ {
+ moveCount++;
+ }
+
+ int moveCount;
+};
+
+void tst_QWidget_window::tst_move_count()
+{
+ MoveWidget move;
+ move.move(500,500);
+ move.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&move));
+ QTRY_VERIFY(move.moveCount >= 1);
+ move.moveCount = 0;
+
+ move.move(220,250);
+ QTRY_VERIFY(move.moveCount >= 1);
+}
QTEST_MAIN(tst_QWidget_window)
#include "tst_qwidget_window.moc"