From 1b4ce37371252d54ddd08c0e5325d0385217ef26 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 27 Apr 2015 17:09:31 +0200 Subject: Blacklist task258920_mouseBorder on Mac The test keeps failing, perfectly when run singly btw. However the approach of sending mouse move events is inherently fragile due to the use of QCursor::setPos and the expectation that that produces the correct sequence of mouse move events. Change-Id: I12ba1afcfd3fab965b8f93d5def48b435fd2ff33 Reviewed-by: Andy Shaw --- tests/auto/widgets/widgets/qmenu/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/widgets/widgets/qmenu/BLACKLIST (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST new file mode 100644 index 0000000000..de49d5ff45 --- /dev/null +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -0,0 +1,2 @@ +[task258920_mouseBorder] +osx -- cgit v1.2.3 From b64e87f2ed6457b11594e9f4fc522860caa737ab Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 7 May 2015 13:10:13 +0200 Subject: Blacklist task256322_highlight on OS X The test keeps failing. The approach of sending mouse move events is inherently fragile due to the use of QCursor::setPos and the expectation that that produces the correct sequence of mouse move events. Change-Id: I07ec75460b70c27152e8775deffcb77fa9328d0c Reviewed-by: Simon Hausmann --- tests/auto/widgets/widgets/qmenubar/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/widgets/widgets/qmenubar/BLACKLIST (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST new file mode 100644 index 0000000000..e8b4945495 --- /dev/null +++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST @@ -0,0 +1,2 @@ +[task256322_highlight] +osx -- cgit v1.2.3 From a34e9ebc1b908d31ba645688a8b0e9e53c2d3c6e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 6 May 2015 17:00:21 +0200 Subject: QLineEdit: show the clear button if it gets enabled after setting a text We were fetching "lastText" too late, and setting the opacity of the clear button to 0. Change-Id: I82c2aea7dab4af4424fb57e12f78d07a0374457e Task-number: QTBUG-45518 Reviewed-by: Friedemann Kleint --- .../widgets/widgets/qlineedit/tst_qlineedit.cpp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 9417541040..adedc601a9 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -304,6 +304,7 @@ private slots: void undoRedoAndEchoModes(); void clearButton(); + void clearButtonVisibleAfterSettingText_QTBUG_45518(); void sideWidgets(); void shouldShowPlaceholderText_data(); @@ -4273,6 +4274,50 @@ void tst_QLineEdit::clearButton() QVERIFY(!clearButton->isEnabled()); } +void tst_QLineEdit::clearButtonVisibleAfterSettingText_QTBUG_45518() +{ +#ifndef QT_BUILD_INTERNAL + QSKIP("This test requires a developer build"); +#else + QLineEdit edit; + edit.setMinimumWidth(200); + centerOnScreen(&edit); + QLineEditIconButton *clearButton; + clearButton = edit.findChild(); + QVERIFY(!clearButton); + + edit.setText(QStringLiteral("some text")); + edit.show(); + QVERIFY(QTest::qWaitForWindowActive(&edit)); + + QVERIFY(!edit.isClearButtonEnabled()); + + clearButton = edit.findChild(); + QVERIFY(!clearButton); + + edit.setClearButtonEnabled(true); + QVERIFY(edit.isClearButtonEnabled()); + + clearButton = edit.findChild(); + QVERIFY(clearButton); + QVERIFY(clearButton->isVisible()); + + QTRY_VERIFY(clearButton->opacity() > 0); + QTRY_COMPARE(clearButton->cursor().shape(), Qt::ArrowCursor); + + QTest::mouseClick(clearButton, Qt::LeftButton, 0, clearButton->rect().center()); + QTRY_COMPARE(edit.text(), QString()); + + QTRY_COMPARE(clearButton->opacity(), qreal(0)); + QTRY_COMPARE(clearButton->cursor().shape(), clearButton->parentWidget()->cursor().shape()); + + edit.setClearButtonEnabled(false); + QVERIFY(!edit.isClearButtonEnabled()); + clearButton = edit.findChild(); + QVERIFY(!clearButton); +#endif // QT_BUILD_INTERNAL +} + void tst_QLineEdit::sideWidgets() { QWidget testWidget; -- cgit v1.2.3 From 1ac1ae05f551d45772ff2a840dba128abf04171e Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 8 May 2015 13:49:54 +0200 Subject: QDialogButtonBox: prevent crashes on deletions in slots As usual, user code connected to signals emitted from Qt may destroy an object's internal status while a signal is being emitted. Guard a bit QDialogButtonBox signal emissions to prevent crashes in case the button or a dialog get deleted from a slot connected to clicked(). Also, be sure to emit the corresponding accepted/rejected/etc. signal. Change-Id: I7b1888070a8f2f56aa60923a17f90fb5efef145c Task-number: QTBUG-45835 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Marc Mutz --- .../qdialogbuttonbox/tst_qdialogbuttonbox.cpp | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index 9c549365ff..38b473e5ae 100644 --- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -90,6 +90,7 @@ private slots: // void buttons(); void testDelete(); + void testSignalEmissionAfterDelete_QTBUG_45835(); void testRemove(); void testMultipleAdd(); void testStandardButtonMapping_data(); @@ -111,6 +112,7 @@ private: tst_QDialogButtonBox::tst_QDialogButtonBox() { + qRegisterMetaType(); } tst_QDialogButtonBox::~tst_QDialogButtonBox() @@ -414,6 +416,70 @@ void tst_QDialogButtonBox::testDelete() QCOMPARE(buttonBox.buttons().count(), 0); } +class ObjectDeleter : public QObject +{ + Q_OBJECT +public slots: + void deleteButton(QAbstractButton *button) + { + delete button; + } + + void deleteSender() + { + delete sender(); + } +}; + +void tst_QDialogButtonBox::testSignalEmissionAfterDelete_QTBUG_45835() +{ + { + QDialogButtonBox buttonBox; + QCOMPARE(buttonBox.buttons().count(), 0); + + QSignalSpy buttonClickedSpy(&buttonBox, &QDialogButtonBox::clicked); + QVERIFY(buttonClickedSpy.isValid()); + + QSignalSpy buttonBoxAcceptedSpy(&buttonBox, &QDialogButtonBox::accepted); + QVERIFY(buttonBoxAcceptedSpy.isValid()); + + QPushButton *button = buttonBox.addButton("Test", QDialogButtonBox::AcceptRole); + QCOMPARE(buttonBox.buttons().count(), 1); + + ObjectDeleter objectDeleter; + connect(&buttonBox, &QDialogButtonBox::clicked, &objectDeleter, &ObjectDeleter::deleteButton); + + button->click(); + + QCOMPARE(buttonBox.buttons().count(), 0); + QCOMPARE(buttonClickedSpy.count(), 1); + QCOMPARE(buttonBoxAcceptedSpy.count(), 1); + } + + { + QPointer buttonBox(new QDialogButtonBox); + QCOMPARE(buttonBox->buttons().count(), 0); + + QSignalSpy buttonClickedSpy(buttonBox.data(), &QDialogButtonBox::clicked); + QVERIFY(buttonClickedSpy.isValid()); + + QSignalSpy buttonBoxAcceptedSpy(buttonBox.data(), &QDialogButtonBox::accepted); + QVERIFY(buttonBoxAcceptedSpy.isValid()); + + QPushButton *button = buttonBox->addButton("Test", QDialogButtonBox::AcceptRole); + QCOMPARE(buttonBox->buttons().count(), 1); + + ObjectDeleter objectDeleter; + connect(buttonBox.data(), &QDialogButtonBox::clicked, &objectDeleter, &ObjectDeleter::deleteSender); + + button->click(); + + QVERIFY(buttonBox.isNull()); + QCOMPARE(buttonClickedSpy.count(), 1); + QCOMPARE(buttonBoxAcceptedSpy.count(), 0); + } +} + void tst_QDialogButtonBox::testMultipleAdd() { // Add a button into the thing multiple times. -- cgit v1.2.3 From 4964c895406b8316d15668affd32cc5eb7b6c7ea Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 29 May 2015 15:53:02 +0200 Subject: tst_QDockWidget::restoreDockWidget: Add QSKIP for XCB. The positioning test has been observed to fail on X11. Change-Id: I58727126a8742de93ec203e9992a9ae1b454f731 Reviewed-by: Simon Hausmann --- tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index ade9f72543..2bbc2e05b7 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -764,6 +764,8 @@ void tst_QDockWidget::restoreDockWidget() restoreWindow.show(); QVERIFY(QTest::qWaitForWindowExposed(&restoreWindow)); QTRY_VERIFY(dock->isFloating()); + if (!QGuiApplication::platformName().compare("xcb", Qt::CaseInsensitive)) + QSKIP("Skip due to Window manager positioning issues", Abort); QTRY_COMPARE(dock->pos(), dockPos); } } -- cgit v1.2.3