summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/util
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/util')
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp10
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp21
-rw-r--r--tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp4
-rw-r--r--tests/auto/widgets/util/qundostack/tst_qundostack.cpp144
4 files changed, 155 insertions, 24 deletions
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index 50e11611f2..92a8dff218 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -600,10 +600,7 @@ void tst_QCompleter::directoryModel_data()
if (i == 1)
QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << "";
-#if defined(Q_OS_WINCE)
- QTest::newRow("()") << "" << "" << "/" << "/";
- QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files";
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
QTest::newRow("()") << "C" << "" << "C:" << "C:";
QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files";
#elif defined (Q_OS_MAC)
@@ -649,10 +646,7 @@ void tst_QCompleter::fileSystemModel_data()
if (i == 1)
QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << "";
-#if defined(Q_OS_WINCE)
- QTest::newRow("()") << "" << "" << "/" << "/";
- QTest::newRow("()") << "\\Program" << "" << "Program Files" << "\\Program Files";
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
QTest::newRow("()") << "C" << "" << "C:" << "C:";
QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files";
#elif defined (Q_OS_MAC)
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index 2c398e1b2f..67bae43c9d 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -125,6 +125,9 @@ private slots:
void scrollTo();
void scroll();
void overshoot();
+
+private:
+ QTouchDevice *m_touchScreen = QTest::createTouchDevice();
};
/*! \internal
@@ -150,11 +153,8 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
touchPoint.setPos(touchStart);
touchPoint.setScenePos(touchStart);
touchPoint.setScreenPos(touchStart);
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
QTouchEvent touchEvent1(QEvent::TouchBegin,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -168,7 +168,7 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
touchPoint.setScenePos(touchUpdate);
touchPoint.setScreenPos(touchUpdate);
QTouchEvent touchEvent2(QEvent::TouchUpdate,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointMoved,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -192,7 +192,7 @@ void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint
touchPoint.setScenePos(touchEnd);
touchPoint.setScreenPos(touchEnd);
QTouchEvent touchEvent5(QEvent::TouchEnd,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointReleased,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -223,11 +223,8 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from,
touchPoint.setPos(touchStart);
touchPoint.setScenePos(touchStart);
touchPoint.setScreenPos(touchStart);
- QTouchDevice *device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
QTouchEvent touchEvent1(QEvent::TouchBegin,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -239,7 +236,7 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from,
touchPoint.setScenePos(touchUpdate);
touchPoint.setScreenPos(touchUpdate);
QTouchEvent touchEvent2(QEvent::TouchUpdate,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointMoved,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
@@ -252,7 +249,7 @@ void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from,
touchPoint.setScenePos(touchEnd);
touchPoint.setScreenPos(touchEnd);
QTouchEvent touchEvent5(QEvent::TouchEnd,
- device,
+ m_touchScreen,
Qt::NoModifier,
Qt::TouchPointReleased,
(QList<QTouchEvent::TouchPoint>() << touchPoint));
diff --git a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
index a932cf5984..616898c4c5 100644
--- a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
+++ b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp
@@ -107,9 +107,6 @@ void tst_QSystemTrayIcon::getSetCheck()
void tst_QSystemTrayIcon::supportsMessages()
{
// ### fixme: Check platforms.
-#if defined(Q_OS_WINCE)
- QCOMPARE(QSystemTrayIcon::supportsMessages(), false);
-#else
const QString platform = QGuiApplication::platformName();
if (platform.compare(QStringLiteral("xcb"), Qt::CaseInsensitive)
&& platform.compare(QStringLiteral("windows"), Qt::CaseInsensitive)
@@ -117,7 +114,6 @@ void tst_QSystemTrayIcon::supportsMessages()
QEXPECT_FAIL("", "QTBUG-20978 QSystemTrayIcon is unimplemented for this platform", Abort);
}
QCOMPARE(QSystemTrayIcon::supportsMessages(), true);
-#endif
}
void tst_QSystemTrayIcon::lastWindowClosed()
diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
index 8573cea35f..a3e7219892 100644
--- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
+++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
@@ -1200,6 +1200,150 @@ void tst_QUndoStack::setClean()
true, // undoChanged
true); // redoChanged
QCOMPARE(stack.cleanIndex(), -1);
+
+ stack.setClean();
+ QCOMPARE(str, QString());
+ checkState(redoTextChangedSpy,
+ canRedoChangedSpy,
+ undoTextChangedSpy,
+ redoAction,
+ undoAction,
+ canUndoChangedSpy,
+ cleanChangedSpy,
+ indexChangedSpy,
+ stack,
+ true, // clean
+ 1, // count
+ 0, // index
+ false, // canUndo
+ "", // undoText
+ true, // canRedo
+ "insert", // redoText
+ true, // cleanChanged
+ false, // indexChanged
+ false, // undoChanged
+ false); // redoChanged
+ QCOMPARE(stack.cleanIndex(), 0);
+
+ stack.resetClean();
+ QCOMPARE(str, QString());
+ checkState(redoTextChangedSpy,
+ canRedoChangedSpy,
+ undoTextChangedSpy,
+ redoAction,
+ undoAction,
+ canUndoChangedSpy,
+ cleanChangedSpy,
+ indexChangedSpy,
+ stack,
+ false, // clean
+ 1, // count
+ 0, // index
+ false, // canUndo
+ "", // undoText
+ true, // canRedo
+ "insert", // redoText
+ true, // cleanChanged
+ false, // indexChanged
+ false, // undoChanged
+ false); // redoChanged
+ QCOMPARE(stack.cleanIndex(), -1);
+
+ stack.redo();
+ QCOMPARE(str, QString("foo"));
+ checkState(redoTextChangedSpy,
+ canRedoChangedSpy,
+ undoTextChangedSpy,
+ redoAction,
+ undoAction,
+ canUndoChangedSpy,
+ cleanChangedSpy,
+ indexChangedSpy,
+ stack,
+ false, // clean
+ 1, // count
+ 1, // index
+ true, // canUndo
+ "insert", // undoText
+ false, // canRedo
+ "", // redoText
+ false, // cleanChanged
+ true, // indexChanged
+ true, // undoChanged
+ true); // redoChanged
+ QCOMPARE(stack.cleanIndex(), -1);
+
+ stack.setClean();
+ QCOMPARE(str, QString("foo"));
+ checkState(redoTextChangedSpy,
+ canRedoChangedSpy,
+ undoTextChangedSpy,
+ redoAction,
+ undoAction,
+ canUndoChangedSpy,
+ cleanChangedSpy,
+ indexChangedSpy,
+ stack,
+ true, // clean
+ 1, // count
+ 1, // index
+ true, // canUndo
+ "insert", // undoText
+ false, // canRedo
+ "", // redoText
+ true, // cleanChanged
+ false, // indexChanged
+ false, // undoChanged
+ false); // redoChanged
+ QCOMPARE(stack.cleanIndex(), 1);
+
+ stack.undo();
+ QCOMPARE(str, QString());
+ checkState(redoTextChangedSpy,
+ canRedoChangedSpy,
+ undoTextChangedSpy,
+ redoAction,
+ undoAction,
+ canUndoChangedSpy,
+ cleanChangedSpy,
+ indexChangedSpy,
+ stack,
+ false, // clean
+ 1, // count
+ 0, // index
+ false, // canUndo
+ "", // undoText
+ true, // canRedo
+ "insert", // redoText
+ true, // cleanChanged
+ true, // indexChanged
+ true, // undoChanged
+ true); // redoChanged
+ QCOMPARE(stack.cleanIndex(), 1);
+
+ stack.resetClean();
+ QCOMPARE(str, QString());
+ checkState(redoTextChangedSpy,
+ canRedoChangedSpy,
+ undoTextChangedSpy,
+ redoAction,
+ undoAction,
+ canUndoChangedSpy,
+ cleanChangedSpy,
+ indexChangedSpy,
+ stack,
+ false, // clean
+ 1, // count
+ 0, // index
+ false, // canUndo
+ "", // undoText
+ true, // canRedo
+ "insert", // redoText
+ false, // cleanChanged
+ false, // indexChanged
+ false, // undoChanged
+ false); // redoChanged
+ QCOMPARE(stack.cleanIndex(), -1);
}
void tst_QUndoStack::clear()