summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp96
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp8
-rw-r--r--tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp33
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp56
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp1
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp28
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp24
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp4
8 files changed, 196 insertions, 54 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
index b05e3968ea..6fbaa28d69 100644
--- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -95,6 +95,9 @@ private slots:
void QTBUG58851_data();
void QTBUG58851();
+ void QTBUG18001_data();
+ void QTBUG18001();
+
private:
QAbstractItemModel *model;
QItemSelectionModel *selection;
@@ -2922,5 +2925,98 @@ void tst_QItemSelectionModel::QTBUG58851()
}
}
+void tst_QItemSelectionModel::QTBUG18001_data()
+{
+ using IntPair = std::pair<int, int>;
+ using IntPairList = QList<IntPair>;
+ using IntList = QList<int>;
+ using BoolList = QList<bool>;
+
+ QTest::addColumn<IntPairList>("indexesToSelect");
+ QTest::addColumn<IntList>("selectionCommands");
+ QTest::addColumn<BoolList>("expectedSelectedRows");
+ QTest::addColumn<BoolList>("expectedSelectedColums");
+
+ int colSelect = QItemSelectionModel::Select | QItemSelectionModel::Columns;
+ int rowSelect = QItemSelectionModel::Select | QItemSelectionModel::Rows;
+
+ QTest::newRow("Select column 1")
+ << IntPairList { {0, 1} }
+ << IntList{ colSelect }
+ << BoolList{ false, false, false, false, false }
+ << BoolList{ false, true, false, false, false };
+
+ QTest::newRow("Select row 1")
+ << IntPairList { {1, 0} }
+ << IntList{ rowSelect }
+ << BoolList{ false, true, false, false, false }
+ << BoolList{ false, false, false, false, false };
+
+ QTest::newRow("Select column 1+2, row 1+2")
+ << IntPairList { {0, 1}, {0, 2}, {1, 0}, {2, 0} }
+ << IntList{ colSelect, colSelect, rowSelect, rowSelect }
+ << BoolList{ false, true, true, false, false }
+ << BoolList{ false, true, true, false, false };
+
+ QTest::newRow("Select row 1+2, col 1+2")
+ << IntPairList { {1, 0}, {2, 0}, {0, 1}, {0, 2} }
+ << IntList{ rowSelect, rowSelect, colSelect, colSelect }
+ << BoolList{ false, true, true, false, false }
+ << BoolList{ false, true, true, false, false };
+}
+
+void tst_QItemSelectionModel::QTBUG18001()
+{
+ using IntPair = std::pair<int, int>;
+ using IntPairList = QList<IntPair>;
+ using IntList = QList<int>;
+ using BoolList = QList<bool>;
+
+ QFETCH(IntPairList, indexesToSelect);
+ QFETCH(IntList, selectionCommands);
+ QFETCH(BoolList, expectedSelectedRows);
+ QFETCH(BoolList, expectedSelectedColums);
+
+ QStandardItemModel model(5, 5);
+ for (int row = 0; row < model.rowCount(); ++row) {
+ for (int column = 0; column < model.columnCount(); ++column) {
+ QStandardItem *item = new QStandardItem(QString("%0x%1").arg(row).arg(column));
+ model.setItem(row, column, item);
+
+ const bool oddRow = row % 2;
+ const bool oddCol = column % 2;
+
+ if (oddRow == oddCol)
+ item->setSelectable(false);
+ }
+ }
+
+ QItemSelectionModel selectionModel(&model);
+
+ for (int i = 0; i < indexesToSelect.count(); ++i) {
+ QModelIndex idx = model.index( indexesToSelect.at(i).first, indexesToSelect.at(i).second );
+ selectionModel.select(idx, QItemSelectionModel::SelectionFlag(selectionCommands.at(i)));
+ }
+
+ for (int i = 0; i < expectedSelectedRows.count(); ++i) {
+ const bool expected = expectedSelectedRows.at(i);
+ const bool actual = selectionModel.isRowSelected(i, QModelIndex());
+ QByteArray description = QByteArray("Row ") + QByteArray::number(i)
+ + " Expected " + QByteArray::number(expected)
+ + " Actual " + QByteArray::number(actual);
+ QVERIFY2(expected == actual, description.data());
+ }
+
+ for (int i = 0; i < expectedSelectedColums.count(); ++i) {
+ const bool expected = expectedSelectedColums.at(i);
+ const bool actual = selectionModel.isColumnSelected(i, QModelIndex());
+ QByteArray description = QByteArray("Col ") + QByteArray::number(i)
+ + " Expected " + QByteArray::number(expected)
+ + " Actual " + QByteArray::number(actual);
+ QVERIFY2(expected == actual, description.data());
+ }
+
+}
+
QTEST_MAIN(tst_QItemSelectionModel)
#include "tst_qitemselectionmodel.moc"
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 6aa3c498aa..fefb533616 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -324,10 +324,8 @@ public:
public slots:
void cleanup();
private slots:
-#ifndef Q_CC_HPACC
void fromStdString();
void toStdString();
-#endif
void check_QTextIOStream();
void check_QTextStream();
void check_QDataStream();
@@ -4098,8 +4096,6 @@ void tst_QString::setRawData()
QVERIFY(cstr.data_ptr() != csd);
}
-#ifndef Q_CC_HPACC
-// This test crashes on HP-UX with aCC (not supported)
void tst_QString::fromStdString()
{
std::string stroustrup = "foo";
@@ -4110,10 +4106,7 @@ void tst_QString::fromStdString()
QString qtnull = QString::fromStdString( stdnull );
QCOMPARE( qtnull.size(), int(stdnull.size()) );
}
-#endif
-#ifndef Q_CC_HPACC
-// This test crashes on HP-UX with aCC (not supported)
void tst_QString::toStdString()
{
QString nord = "foo";
@@ -4130,7 +4123,6 @@ void tst_QString::toStdString()
std::string stdnull = qtnull.toStdString();
QCOMPARE( int(stdnull.size()), qtnull.size() );
}
-#endif
void tst_QString::utf8()
{
diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index ed5d0c69a0..8b49679042 100644
--- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -164,7 +164,9 @@ void tst_QNetworkCookieJar::setCookiesFromUrl_data()
result.clear();
preset.clear();
cookie.setDomain(".foo.ck");
- QTest::newRow("effective-tld2-denied") << preset << cookie << "http://foo.ck" << result << false;
+ result += cookie;
+ QTest::newRow("effective-tld2-accepted2") << preset << cookie << "http://foo.ck" << result << true;
+ result.clear();
QTest::newRow("effective-tld2-denied2") << preset << cookie << "http://www.foo.ck" << result << false;
QTest::newRow("effective-tld2-denied3") << preset << cookie << "http://www.anything.foo.ck" << result << false;
cookie.setDomain(".www.ck");
@@ -208,6 +210,22 @@ void tst_QNetworkCookieJar::setCookiesFromUrl_data()
preset.clear();
cookie.setDomain(".com.");
QTest::newRow("rfc2109-4.3.2-ex3-2") << preset << cookie << "http://x.foo.com" << result << false;
+
+ // When using a TLD as a hostname the hostname should still get cookies (QTBUG-52040)
+ // ... and nothing else should get the cookies.
+ result.clear();
+ preset.clear();
+ cookie.setPath("/");
+ cookie.setDomain(".support");
+ result += cookie;
+ QTest::newRow("TLD-as-domain-accepted") << preset << cookie << "http://support" << result << true;
+ result.clear();
+ QTest::newRow("TLD-as-domain-rejected") << preset << cookie << "http://a.support" << result << false;
+ // Now test with no domain in the cookie, use the domain from the url (matching TLD)
+ cookie.setDomain("support");
+ result += cookie;
+ cookie.setDomain("");
+ QTest::newRow("TLD-as-domain-accepted2") << preset << cookie << "http://support" << result << true;
}
void tst_QNetworkCookieJar::setCookiesFromUrl()
@@ -351,6 +369,19 @@ void tst_QNetworkCookieJar::cookiesForUrl_data()
result.clear();
result += rootCookie;
QTest::newRow("root-path-match") << allCookies << "http://qt-project.org" << result;
+
+ // Domain in cookie happens to match a TLD
+ allCookies.clear();
+ QNetworkCookie tldCookie;
+ tldCookie.setDomain(".support");
+ tldCookie.setName("a");
+ tldCookie.setValue("b");
+ allCookies += tldCookie;
+ result.clear();
+ result += tldCookie;
+ QTest::newRow("tld-cookie-match") << allCookies << "http://support/" << result;
+ result.clear();
+ QTest::newRow("tld-cookie-no-match") << allCookies << "http://a.support/" << result;
}
void tst_QNetworkCookieJar::cookiesForUrl()
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp
index d153146574..0767efb817 100644
--- a/tests/auto/other/gestures/tst_gestures.cpp
+++ b/tests/auto/other/gestures/tst_gestures.cpp
@@ -43,24 +43,6 @@
#include <qdebug.h>
-static bool waitForWindowExposed(QWindow *window)
-{
- if (!window)
- return false;
-#ifdef Q_OS_OSX
- QTest::qWait(100);
- return window->isExposed();
-#endif
- return QTest::qWaitForWindowExposed(window);
-}
-
-static bool waitForWindowExposed(QWidget *widget)
-{
- if (!widget)
- return false;
- return waitForWindowExposed(widget->windowHandle());
-}
-
static QPointF mapToGlobal(const QPointF &pt, QGraphicsItem *item, QGraphicsView *view)
{
return view->viewport()->mapToGlobal(view->mapFromScene(item->mapToScene(pt)));
@@ -376,7 +358,7 @@ void tst_Gestures::customGesture()
GestureWidget widget;
widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
widget.show();
- QVERIFY(waitForWindowExposed(&widget));
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
CustomEvent event;
event.hotSpot = widget.mapToGlobal(QPoint(5,5));
@@ -845,7 +827,7 @@ void tst_Gestures::graphicsItemGesture()
item->setPos(100, 100);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item->grabGesture(CustomGesture::GestureType);
@@ -907,7 +889,7 @@ void tst_Gestures::graphicsView()
item->setPos(100, 100);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item->grabGesture(CustomGesture::GestureType);
@@ -983,7 +965,7 @@ void tst_Gestures::graphicsItemTreeGesture()
item1_child2->setParentItem(item1);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType);
@@ -1040,7 +1022,7 @@ void tst_Gestures::explicitGraphicsObjectTarget()
item2_child1->setPos(10, 10);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
@@ -1099,7 +1081,7 @@ void tst_Gestures::gestureOverChildGraphicsItem()
item2_child1->setPos(0, 0);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType);
@@ -1397,7 +1379,7 @@ void tst_Gestures::testMapToScene()
item0->setPos(14, 16);
view.show(); // need to show to give it a global coordinate
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
QPoint origin = view.mapToGlobal(QPoint());
@@ -1523,7 +1505,7 @@ void tst_Gestures::autoCancelGestures()
parent.grabGesture(CustomGesture::GestureType);
child->grabGesture(secondGesture);
parent.show();
- QVERIFY(waitForWindowExposed(&parent));
+ QVERIFY(QTest::qWaitForWindowExposed(&parent));
/*
An event is sent to both the child and the parent, when the child gets it a gesture is triggered
@@ -1582,7 +1564,7 @@ void tst_Gestures::autoCancelGestures2()
child->grabGesture(secondGesture);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
CustomEvent event;
@@ -1628,7 +1610,7 @@ void tst_Gestures::graphicsViewParentPropagation()
item1_c1_c1->setPos(0, 0);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent);
@@ -1698,7 +1680,7 @@ void tst_Gestures::panelPropagation()
item1_child1_child1->setZValue(10);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -1809,7 +1791,7 @@ void tst_Gestures::panelStacksBehindParent()
panel->setZValue(5);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -1893,7 +1875,7 @@ void tst_Gestures::deleteGestureTargetItem()
items.insert(item2->objectName(), item2);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
if (propagateUpdateGesture)
@@ -1938,7 +1920,7 @@ void tst_Gestures::viewportCoordinates()
scene.addItem(item1);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
CustomEvent event;
@@ -1975,7 +1957,7 @@ void tst_Gestures::partialGesturePropagation()
scene.addItem(item4);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->ignoredUpdatedGestures << CustomGesture::GestureType;
@@ -2063,7 +2045,7 @@ void tst_Gestures::testQGestureRecognizerCleanup()
//QGestureRecognizer::registerRecognizer(new PanRecognizer(PanRecognizer::Custom));
w->show();
- QVERIFY(waitForWindowExposed(w));
+ QVERIFY(QTest::qWaitForWindowExposed(w));
delete w;
}
@@ -2184,7 +2166,7 @@ void tst_Gestures::testReuseCanceledGestures()
gv->viewport()->grabGesture(tapGestureTypeId);
mw.show();
- QVERIFY(waitForWindowExposed(&mw));
+ QVERIFY(QTest::qWaitForWindowExposed(&mw));
QPoint targetPos(gv->mapFromScene(target->mapToScene(target->rect().center())));
targetPos = gv->viewport()->mapFromParent(targetPos);
@@ -2250,7 +2232,7 @@ void tst_Gestures::conflictingGesturesInGraphicsView()
scene.addItem(item2);
view.show();
- QVERIFY(waitForWindowExposed(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -2315,7 +2297,7 @@ void tst_Gestures::bug_13501_gesture_not_accepted()
NoConsumeWidgetBug13501 w;
w.grabGesture(Qt::TapGesture);
w.show();
- QVERIFY(waitForWindowExposed(&w));
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
//QTest::mousePress(&ignoreEvent, Qt::LeftButton);
QTouchDevice *device = QTest::createTouchDevice();
QTest::touchEvent(&w, device).press(0, QPoint(10, 10), &w);
diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
index 37521a64aa..e82327bbb1 100644
--- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
@@ -304,6 +304,7 @@ void tst_QFocusEvent::checkReason_focusWidget()
frame1.setLayout(&leftLayout);
frame2.setLayout(&rightLayout);
window1.show();
+ QVERIFY(QTest::qWaitForWindowActive(&window1));
edit1.setFocus();
QTRY_VERIFY(edit1.hasFocus());
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index e1c4019fba..ff2d8fd191 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -401,6 +401,8 @@ private slots:
void tabletTracking();
+ void closeEvent();
+
private:
bool ensureScreenSize(int width, int height);
@@ -10808,5 +10810,31 @@ void tst_QWidget::tabletTracking()
QTRY_COMPARE(widget.moveEventCount, 3);
}
+class CloseCountingWidget : public QWidget
+{
+public:
+ int closeCount = 0;
+ void closeEvent(QCloseEvent *ev) override;
+};
+
+void CloseCountingWidget::closeEvent(QCloseEvent *ev)
+{
+ ++closeCount;
+ ev->accept();
+}
+
+void tst_QWidget::closeEvent()
+{
+ CloseCountingWidget widget;
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ // Yes we call the close() function twice. This mimics the behavior of QTBUG-43344 where
+ // QApplication first closes all windows and then QCocoaApplication flushes window system
+ // events, triggering more close events.
+ widget.windowHandle()->close();
+ widget.windowHandle()->close();
+ QCOMPARE(widget.closeCount, 1);
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 9da33d9525..7eb739611a 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -319,6 +319,7 @@ private:
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
bool unselectingWithLeftOrRightChangesCursorPosition();
+ void addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey);
QLineEdit *ensureTestWidget();
bool validInput;
@@ -724,7 +725,7 @@ void tst_QLineEdit::keypress_inputMask_data()
{
QTestEventList keys;
// inserting 'A1.2B'
- keys.addKeyClick(Qt::Key_Home);
+ addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine);
keys.addKeyClick(Qt::Key_A);
keys.addKeyClick(Qt::Key_1);
keys.addKeyClick(Qt::Key_Period);
@@ -735,7 +736,7 @@ void tst_QLineEdit::keypress_inputMask_data()
{
QTestEventList keys;
// inserting 'A1.2B'
- keys.addKeyClick(Qt::Key_Home);
+ addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine);
keys.addKeyClick(Qt::Key_0);
keys.addKeyClick(Qt::Key_Exclam);
keys.addKeyClick('P');
@@ -745,22 +746,24 @@ void tst_QLineEdit::keypress_inputMask_data()
{
QTestEventList keys;
// pressing delete
- keys.addKeyClick(Qt::Key_Home);
+ addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine);
keys.addKeyClick(Qt::Key_Delete);
QTest::newRow("delete") << QString("000.000;_") << keys << QString(".") << QString("___.___");
}
{
QTestEventList keys;
// selecting all and delete
- keys.addKeyClick(Qt::Key_Home);
- keys.addKeyClick(Qt::Key_End, Qt::ShiftModifier);
+ keys.addKeyClick(Qt::Key_1);
+ keys.addKeyClick(Qt::Key_2);
+ addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine);
+ addKeySequenceStandardKey(keys, QKeySequence::SelectEndOfLine);
keys.addKeyClick(Qt::Key_Delete);
QTest::newRow("deleting all") << QString("000.000;_") << keys << QString(".") << QString("___.___");
}
{
QTestEventList keys;
// inserting '12.12' then two backspaces
- keys.addKeyClick(Qt::Key_Home);
+ addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine);
keys.addKeyClick(Qt::Key_1);
keys.addKeyClick(Qt::Key_2);
keys.addKeyClick(Qt::Key_Period);
@@ -773,7 +776,7 @@ void tst_QLineEdit::keypress_inputMask_data()
{
QTestEventList keys;
// inserting '12ab'
- keys.addKeyClick(Qt::Key_Home);
+ addKeySequenceStandardKey(keys, QKeySequence::MoveToStartOfLine);
keys.addKeyClick(Qt::Key_1);
keys.addKeyClick(Qt::Key_2);
keys.addKeyClick(Qt::Key_A);
@@ -1971,6 +1974,13 @@ void tst_QLineEdit::psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardMo
keys.addKeyClick(key, pressState);
}
+void tst_QLineEdit::addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey key)
+{
+ QKeySequence keyseq = QKeySequence(key);
+ for (int i = 0; i < keyseq.count(); ++i)
+ keys.addKeyClick( Qt::Key( keyseq[i] & ~Qt::KeyboardModifierMask), Qt::KeyboardModifier(keyseq[i] & Qt::KeyboardModifierMask) );
+}
+
void tst_QLineEdit::cursorPosition()
{
QLineEdit *testWidget = ensureTestWidget();
diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
index cd7fe3710d..cbf5196bb9 100644
--- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
@@ -549,7 +549,9 @@ void tst_QTabWidget::paintEventCount()
QCOMPARE(tw->currentIndex(), 0);
tw->show();
- QVERIFY(QTest::qWaitForWindowActive(tw));
+ QVERIFY(QTest::qWaitForWindowExposed(tw));
+ // Wait for extra paint events that happen at least on macOS
+ QTest::qWait(1000);
// Mac, Windows and Windows CE get multiple repaints on the first show, so use those as a starting point.
static const int MaxInitialPaintCount =