From e342a2e05f1e73c1a5cc4d029f9316401d07f3d6 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 11 Feb 2016 10:37:10 -0800 Subject: Add auto-test for crash in QCocoaBackingStore This issue has been solved some time between 5.6 and 5.6.0. We just make sure to protect against further regressions. Change-Id: Ic3fdad901ed5f36792ae04b3d65047da95eea668 Task-number: QTBUG-50561 Reviewed-by: Friedemann Kleint --- .../kernel/qwidget_window/tst_qwidget_window.cpp | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'tests/auto') 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 58e85d6b58..27be063333 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include static inline void setFrameless(QWidget *w) @@ -99,6 +101,8 @@ private slots: void tst_move_count(); void tst_eventfilter_on_toplevel(); + + void QTBUG_50561_QCocoaBackingStore_paintDevice_crash(); }; void tst_QWidget_window::initTestCase() @@ -795,5 +799,46 @@ void tst_QWidget_window::tst_eventfilter_on_toplevel() QTRY_COMPARE(filter.eventCount, 1); } +class ApplicationStateSaver +{ +public: + ApplicationStateSaver() + { + QApplication::setAttribute(Qt::AA_NativeWindows, true); + QApplication::setQuitOnLastWindowClosed(false); + } + + ~ApplicationStateSaver() + { + QApplication::setAttribute(Qt::AA_NativeWindows, false); + QApplication::setQuitOnLastWindowClosed(true); + } +}; + +void tst_QWidget_window::QTBUG_50561_QCocoaBackingStore_paintDevice_crash() +{ + // Keep application state clean if testcase fails + ApplicationStateSaver as; + + QMainWindow w; + w.addToolBar(new QToolBar(&w)); + w.show(); + QTest::qWaitForWindowExposed(&w); + + // Simulate window system close + QCloseEvent *e = new QCloseEvent; + e->accept(); + qApp->postEvent(w.windowHandle(), e); + qApp->processEvents(); + + // Show again + w.show(); + qApp->processEvents(); + + // No crash, all good. + // Wrap up and leave + w.close(); +} + QTEST_MAIN(tst_QWidget_window) #include "tst_qwidget_window.moc" -- cgit v1.2.3 From 005a8bfbf0022f03dafafcf2b5c438ccf0675a49 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Fri, 18 Mar 2016 12:53:12 -0400 Subject: Remove QPROCESS_USE_SPAWN and all that it surrounds The spawn code was only used to make QProcess work on QNX 6.5.0. Fork works on QNX 6.6.0. The QNX spawn implementation has a flaw that causes a deadlock in certain situations. When a working directory is specified for the process, the QNX spawn implementation stops all threads except the one doing the spawn so that it can temporarily change the process' working directory. This can lead to a deadlock if the thread does anything that conficts with something being done in a stopped thread. QNX 6.5.0 is no longer supported in Qt 5.6.0 so we can just switch QNX to the fork implementation and get rid of the spawn implementation. Made a QNX specific adjustment to the hardExit test. There's a bug in the OS that the test can run into because it does something that normal applications wouldn't. Task-number: QTBUG-47250 Change-Id: Ib32567d2c15ce651815858000035ac5aa6f35224 Reviewed-by: Dan Cape Reviewed-by: Oswald Buddenhagen Reviewed-by: Rafael Roquetto --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 38 +++++++------------------ 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 46bf1a19e8..7e1d5487ba 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -45,8 +45,6 @@ #include #include -# include // only so we get QPROCESS_USE_SPAWN - typedef void (QProcess::*QProcessFinishedSignal1)(int); typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus); typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError); @@ -325,9 +323,6 @@ void tst_QProcess::startDetached() { QVERIFY(QProcess::startDetached("testProcessNormal/testProcessNormal", QStringList() << "arg1" << "arg2")); -#ifdef QPROCESS_USE_SPAWN - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue); -#endif QCOMPARE(QProcess::startDetached("nonexistingexe"), false); } @@ -707,9 +702,6 @@ void tst_QProcess::waitForFinished() QCOMPARE(output.count("\n"), 10*1024); process.start("blurdybloop"); -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort); -#endif QVERIFY(!process.waitForFinished()); QCOMPARE(process.error(), QProcess::FailedToStart); } @@ -922,6 +914,16 @@ void tst_QProcess::hardExit() #endif QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); + +#if defined(Q_OS_QNX) + // QNX may lose the kill if it's delivered while the forked process + // is doing the exec that morphs it into testProcessEcho. It's very + // unlikely that a normal application would do such a thing. Make + // sure the test doesn't accidentally try to do it. + proc.write("A"); + QVERIFY(proc.waitForReadyRead(5000)); +#endif + proc.kill(); QVERIFY(proc.waitForFinished(5000)); @@ -1503,11 +1505,6 @@ void tst_QProcess::nativeArguments() void tst_QProcess::exitCodeTest() { for (int i = 0; i < 255; ++i) { -#ifdef QPROCESS_USE_SPAWN - // POSIX reserves exit code 127 when using posix_spawn - if (i == 127) - continue; -#endif QProcess process; process.start("testExitCodes/testExitCodes " + QString::number(i)); QVERIFY(process.waitForFinished(5000)); @@ -1518,9 +1515,6 @@ void tst_QProcess::exitCodeTest() void tst_QProcess::failToStart() { -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QSKIP("QProcess cannot detect failure to start when using posix_spawn()"); -#endif qRegisterMetaType("QProcess::ProcessError"); qRegisterMetaType("QProcess::ExitStatus"); qRegisterMetaType("QProcess::ProcessState"); @@ -1591,9 +1585,6 @@ void tst_QProcess::failToStart() void tst_QProcess::failToStartWithWait() { -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QSKIP("QProcess cannot detect failure to start when using posix_spawn()"); -#endif qRegisterMetaType("QProcess::ProcessError"); qRegisterMetaType("QProcess::ExitStatus"); @@ -1623,9 +1614,6 @@ void tst_QProcess::failToStartWithWait() void tst_QProcess::failToStartWithEventLoop() { -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QSKIP("QProcess cannot detect failure to start when using posix_spawn()"); -#endif qRegisterMetaType("QProcess::ProcessError"); qRegisterMetaType("QProcess::ExitStatus"); @@ -1912,9 +1900,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QVERIFY(!process.waitForReadyRead()); // used to crash process.start("doesntexist"); QVERIFY(!process.waitForReadyRead()); -#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort); -#endif QCOMPARE(errorSpy.count(), 1); QCOMPARE(errorSpy.at(0).at(0).toInt(), 0); QCOMPARE(errorSpy2.count(), 1); @@ -2282,9 +2267,6 @@ void tst_QProcess::setNonExistentWorkingDirectory() // while on Unix with fork it's relative to the child's (with posix_spawn, it could be either). process.start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath()); QVERIFY(!process.waitForFinished()); -#ifdef QPROCESS_USE_SPAWN - QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue); -#endif QCOMPARE(int(process.error()), int(QProcess::FailedToStart)); } #endif -- cgit v1.2.3 From 4ccfb1eb926e8a6b26ea11e3e38df5b2dd3d0de4 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Sat, 12 Mar 2016 10:33:19 +0100 Subject: Fix tests for build with -no-gui Change-Id: I48d5452daeaf3490ed7a5b8c30953da019bb33af Reviewed-by: Oswald Buddenhagen Reviewed-by: Kevin Funk --- tests/auto/auto.pro | 2 +- tests/auto/other/other.pro | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 9cab3c9e42..cc916edbad 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -24,7 +24,7 @@ ios: SUBDIRS = corelib gui wince: SUBDIRS -= printsupport cross_compile: SUBDIRS -= tools !qtHaveModule(opengl): SUBDIRS -= opengl -!qtHaveModule(gui): SUBDIRS -= gui cmake +!qtHaveModule(gui): SUBDIRS -= gui cmake installed_cmake !qtHaveModule(widgets): SUBDIRS -= widgets !qtHaveModule(printsupport): SUBDIRS -= printsupport !qtHaveModule(concurrent): SUBDIRS -= concurrent diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro index 673e922fdd..0e9f054a01 100644 --- a/tests/auto/other/other.pro +++ b/tests/auto/other/other.pro @@ -24,6 +24,10 @@ SUBDIRS=\ windowsmobile \ toolsupport \ +!qtHaveModule(gui): SUBDIRS -= \ + qcomplextext \ + qprocess_and_guieventloop \ + !qtHaveModule(widgets): SUBDIRS -= \ gestures \ lancelot \ -- cgit v1.2.3 From 1bbbb682b56df0a212dc5a7e249fa3b630111a10 Mon Sep 17 00:00:00 2001 From: Marko Kangas Date: Tue, 22 Mar 2016 12:47:11 +0200 Subject: Initialize input method for read-only QTextBrowser Set input method attribute to be aligned with read-only value in QTextBrowser initialization Task-number: QTBUG-52071 Change-Id: If0e64bf09e2a2d505ed66fcbfb8cd12ae39844d3 Reviewed-by: Andy Shaw --- tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp index adc768f828..8c9e908228 100644 --- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp @@ -92,6 +92,7 @@ private slots: void clearHistory(); void sourceInsideLoadResource(); void textInteractionFlags_vs_readOnly(); + void inputMethodAttribute_vs_readOnly(); void anchorsWithSelfBuiltHtml(); void relativeNonLocalUrls(); void adjacentAnchors(); @@ -455,6 +456,16 @@ void tst_QTextBrowser::textInteractionFlags_vs_readOnly() QCOMPARE(browser->textInteractionFlags(), Qt::TextBrowserInteraction); } +void tst_QTextBrowser::inputMethodAttribute_vs_readOnly() +{ + QVERIFY(browser->isReadOnly()); + QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled)); + browser->setReadOnly(false); + QVERIFY(browser->testAttribute(Qt::WA_InputMethodEnabled)); + browser->setReadOnly(true); + QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled)); +} + void tst_QTextBrowser::anchorsWithSelfBuiltHtml() { browser->setHtml("

Hello Link" -- cgit v1.2.3 From fce83bd9f84883f93829e6ca9eacf098b018a02d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 22 Mar 2016 11:59:56 +0100 Subject: QAbstractItemView: trigger handlers (and redraw) when changing selection model The most visible problem is that changing selection model didn't update() the view, resulting in the old selection/current item still being drawn. In general trigger the handlers for when the selection/current item changes. Change-Id: Ib3b2ad70412e6a21a182d4c173e617710bcc630d Task-number: QTBUG-50535 Reviewed-by: Stephen Kelly --- .../qabstractitemview/tst_qabstractitemview.cpp | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 3a17f7c690..2b2f130060 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -251,6 +252,7 @@ private slots: void sizeHintChangeTriggersLayout(); void shiftSelectionAfterChangingModelContents(); void QTBUG48968_reentrant_updateEditorGeometries(); + void QTBUG50535_update_on_new_selection_model(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -2028,5 +2030,57 @@ void tst_QAbstractItemView::QTBUG48968_reentrant_updateEditorGeometries() // No crash, all fine. } +void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() +{ + QStandardItemModel model; + for (int i = 0; i < 10; ++i) + model.appendRow(new QStandardItem(QStringLiteral("%1").arg(i))); + + class ListView : public QListView + { + public: + ListView() + : m_paintEventsCount(0) + { + } + + int m_paintEventsCount; + + protected: + bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE + { + if (event->type() == QEvent::Paint) + ++m_paintEventsCount; + return QListView::viewportEvent(event); + } + }; + + // keep the current/selected row in the "low range", i.e. be sure it's visible, otherwise we + // don't get updates and the test fails. + + ListView view; + view.setModel(&model); + view.selectionModel()->setCurrentIndex(model.index(1, 0), QItemSelectionModel::SelectCurrent); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + + QItemSelectionModel selectionModel(&model); + selectionModel.setCurrentIndex(model.index(2, 0), QItemSelectionModel::Current); + + int oldPaintEventsCount = view.m_paintEventsCount; + view.setSelectionModel(&selectionModel); + QTRY_VERIFY(view.m_paintEventsCount > oldPaintEventsCount); + + + QItemSelectionModel selectionModel2(&model); + selectionModel2.select(model.index(0, 0), QItemSelectionModel::ClearAndSelect); + selectionModel2.setCurrentIndex(model.index(1, 0), QItemSelectionModel::Current); + + oldPaintEventsCount = view.m_paintEventsCount; + view.setSelectionModel(&selectionModel2); + QTRY_VERIFY(view.m_paintEventsCount > oldPaintEventsCount); +} + QTEST_MAIN(tst_QAbstractItemView) #include "tst_qabstractitemview.moc" -- cgit v1.2.3 From 4ca77851612a1b89f3e403db356641f3919304fd Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 22 Mar 2016 15:53:36 +0100 Subject: QAbstractItemView test: check that the selection model is in sync with the view Change-Id: Ifca91154b47184a9d9a1979e1fba471517e16698 Reviewed-by: Stephen Kelly --- .../qabstractitemview/tst_qabstractitemview.cpp | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 2b2f130060..6cbf51efd9 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -253,6 +253,7 @@ private slots: void shiftSelectionAfterChangingModelContents(); void QTBUG48968_reentrant_updateEditorGeometries(); void QTBUG50535_update_on_new_selection_model(); + void testSelectionModelInSyncWithView(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -2082,5 +2083,59 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() QTRY_VERIFY(view.m_paintEventsCount > oldPaintEventsCount); } +void tst_QAbstractItemView::testSelectionModelInSyncWithView() +{ + QStandardItemModel model; + for (int i = 0; i < 10; ++i) + model.appendRow(new QStandardItem(QStringLiteral("%1").arg(i))); + + class ListView : public QListView + { + public: + using QListView::selectedIndexes; + }; + + ListView view; + QVERIFY(!view.selectionModel()); + + view.setModel(&model); + QVERIFY(view.selectionModel()); + QVERIFY(view.selectedIndexes().isEmpty()); + QVERIFY(view.selectionModel()->selection().isEmpty()); + + view.setCurrentIndex(model.index(0, 0)); + QCOMPARE(view.currentIndex(), model.index(0, 0)); + QCOMPARE(view.selectionModel()->currentIndex(), model.index(0, 0)); + + view.selectionModel()->setCurrentIndex(model.index(1, 0), QItemSelectionModel::SelectCurrent); + QCOMPARE(view.currentIndex(), model.index(1, 0)); + QCOMPARE(view.selectedIndexes(), QModelIndexList() << model.index(1, 0)); + QCOMPARE(view.selectionModel()->currentIndex(), model.index(1, 0)); + QCOMPARE(view.selectionModel()->selection().indexes(), QModelIndexList() << model.index(1, 0)); + + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + QItemSelectionModel selectionModel(&model); + selectionModel.setCurrentIndex(model.index(2, 0), QItemSelectionModel::Current); + + view.setSelectionModel(&selectionModel); + QCOMPARE(view.currentIndex(), model.index(2, 0)); + QCOMPARE(view.selectedIndexes(), QModelIndexList()); + QCOMPARE(view.selectionModel()->currentIndex(), model.index(2, 0)); + QCOMPARE(view.selectionModel()->selection().indexes(), QModelIndexList()); + + + QItemSelectionModel selectionModel2(&model); + selectionModel2.select(model.index(0, 0), QItemSelectionModel::ClearAndSelect); + selectionModel2.setCurrentIndex(model.index(1, 0), QItemSelectionModel::Current); + + view.setSelectionModel(&selectionModel2); + QCOMPARE(view.currentIndex(), model.index(1, 0)); + QCOMPARE(view.selectedIndexes(), QModelIndexList() << model.index(0, 0)); + QCOMPARE(view.selectionModel()->currentIndex(), model.index(1, 0)); + QCOMPARE(view.selectionModel()->selection().indexes(), QModelIndexList() << model.index(0, 0)); +} + QTEST_MAIN(tst_QAbstractItemView) #include "tst_qabstractitemview.moc" -- cgit v1.2.3 From 24411e9743735d6323f1d3686f8b989a5122f83b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Mar 2016 15:45:12 +0100 Subject: Add a write buffer to QLocalSocket/Win Commit 0307c008 removed the buffering of data-to-be-written from QWindowsPipeWriter, because it was assumed that users of this class (QProcess and QLocalSocket) already buffer data internally. This assumption was wrong for QLocalSocket. The following sequence localSocket->write(someData); localSocket->write(someMoreData); would not write anything on the second write. Add a write buffer to the Windows implementation of QLocalSocket. Task-number: QTBUG-52073 Change-Id: I6d0f03a722ec48138cbde3e2f69aae7dafe790d3 Reviewed-by: Oswald Buddenhagen --- .../network/socket/qlocalsocket/tst_qlocalsocket.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index d12a6b53c3..bfe43673d2 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -102,7 +102,10 @@ private slots: void multiConnect(); void writeOnlySocket(); + + void writeToClientAndDisconnect_data(); void writeToClientAndDisconnect(); + void debug(); void bytesWrittenSignal(); void syncDisconnectNotify(); @@ -1034,8 +1037,16 @@ void tst_QLocalSocket::writeOnlySocket() QCOMPARE(client.state(), QLocalSocket::ConnectedState); } +void tst_QLocalSocket::writeToClientAndDisconnect_data() +{ + QTest::addColumn("chunks"); + QTest::newRow("one chunk") << 1; + QTest::newRow("several chunks") << 20; +} + void tst_QLocalSocket::writeToClientAndDisconnect() { + QFETCH(int, chunks); QLocalServer server; QLocalSocket client; QSignalSpy readChannelFinishedSpy(&client, SIGNAL(readChannelFinished())); @@ -1049,14 +1060,17 @@ void tst_QLocalSocket::writeToClientAndDisconnect() char buffer[100]; memset(buffer, 0, sizeof(buffer)); - QCOMPARE(clientSocket->write(buffer, sizeof(buffer)), (qint64)sizeof(buffer)); - clientSocket->waitForBytesWritten(); + for (int i = 0; i < chunks; ++i) + QCOMPARE(clientSocket->write(buffer, sizeof(buffer)), qint64(sizeof(buffer))); + while (clientSocket->bytesToWrite()) + QVERIFY(clientSocket->waitForBytesWritten()); clientSocket->close(); server.close(); client.waitForDisconnected(); QCOMPARE(readChannelFinishedSpy.count(), 1); - QCOMPARE(client.read(buffer, sizeof(buffer)), (qint64)sizeof(buffer)); + const QByteArray received = client.readAll(); + QCOMPARE(received.size(), qint64(sizeof(buffer) * chunks)); QCOMPARE(client.state(), QLocalSocket::UnconnectedState); } -- cgit v1.2.3 From aedda12ef1a2a9945d32afbc7e46f21773aed223 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 9 Mar 2016 16:22:35 +0100 Subject: tst_QAtomicInteger: fix UBs (signed overflow) Drop addSub() test. It executes exactly the union of fetchAndAdd() and fetchAndSub(), which have already had their UBs fixed. No need to do fixes in duplicated code. Change-Id: Ib72caab0310fce3ff9a40c261d8a38518f91ecaf Reviewed-by: David Faure --- .../thread/qatomicinteger/tst_qatomicinteger.cpp | 93 ---------------------- 1 file changed, 93 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index ff41ccf26b..6b3a99100b 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -179,9 +179,6 @@ private Q_SLOTS: void fetchAndSub_data() { addData(); } void fetchAndSub(); - void addSub_data() { addData(); } - void addSub(); - void fetchAndOr_data() { addData(); } void fetchAndOr(); @@ -661,96 +658,6 @@ void tst_QAtomicIntegerXX::fetchAndSub() } } -void tst_QAtomicIntegerXX::addSub() -{ - QFETCH(LargeInt, value); - QAtomicInteger atomic(value); - - // note: this test has undefined behavior for signed max and min - T parcel1 = 42; - T parcel2 = T(0-parcel1); - T newValue1 = T(value) + parcel1; - T newValue2 = T(value) - parcel1; - - QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), newValue1); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubRelaxed(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndAddRelaxed(parcel1), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubRelaxed(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndAddRelaxed(parcel2), newValue1); - QCOMPARE(atomic.load(), T(value)); - - QCOMPARE(atomic.fetchAndAddAcquire(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndSubAcquire(parcel1), newValue1); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubAcquire(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndAddAcquire(parcel1), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndAddAcquire(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndSubAcquire(parcel2), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubAcquire(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndAddAcquire(parcel2), newValue1); - QCOMPARE(atomic.load(), T(value)); - - QCOMPARE(atomic.fetchAndAddRelease(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndSubRelease(parcel1), newValue1); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubRelease(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndAddRelease(parcel1), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndAddRelease(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndSubRelease(parcel2), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubRelease(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndAddRelease(parcel2), newValue1); - QCOMPARE(atomic.load(), T(value)); - - QCOMPARE(atomic.fetchAndAddOrdered(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndSubOrdered(parcel1), newValue1); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubOrdered(parcel1), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndAddOrdered(parcel1), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndAddOrdered(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue2); - QCOMPARE(atomic.fetchAndSubOrdered(parcel2), newValue2); - QCOMPARE(atomic.load(), T(value)); - QCOMPARE(atomic.fetchAndSubOrdered(parcel2), T(value)); - QCOMPARE(atomic.load(), newValue1); - QCOMPARE(atomic.fetchAndAddOrdered(parcel2), newValue1); - QCOMPARE(atomic.load(), T(value)); - - // operator+= and operator-= - QCOMPARE(atomic += parcel1, newValue1); - QCOMPARE(atomic -= parcel1, T(value)); - QCOMPARE(atomic -= parcel1, newValue2); - QCOMPARE(atomic += parcel1, T(value)); - QCOMPARE(atomic += parcel2, newValue2); - QCOMPARE(atomic -= parcel2, T(value)); - QCOMPARE(atomic -= parcel2, newValue1); - QCOMPARE(atomic += parcel2, T(value)); -} - void tst_QAtomicIntegerXX::fetchAndOr() { QFETCH(LargeInt, value); -- cgit v1.2.3 From 1534297323284c8e5daec36246bc30d968899f2f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 24 Mar 2016 11:03:08 +0100 Subject: Update comment in tst_QLocalSocket::readBufferOverflow QWindowsPipeWriter doesn't write in a separate thread anymore. Change-Id: Id978bfdfa2531be91cce94476ab9b0dff237bd61 Reviewed-by: Kai Koehne --- tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index bfe43673d2..a96c88874e 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -611,7 +611,7 @@ void tst_QLocalSocket::readBufferOverflow() serverSocket->write(buffer, dataBufferSize); #ifndef Q_OS_WIN // The data is not immediately sent, but buffered. - // On Windows, the flushing is done asynchronously by a separate thread. + // On Windows, the flushing is done by an asynchronous write operation. // However, this operation will never complete as long as the data is not // read by the other end, so the call below always times out. // On Unix, the flushing is synchronous and thus needs to be done before -- cgit v1.2.3 From 705d29585b9a006b2fc8dd77ebf7a67b3670011b Mon Sep 17 00:00:00 2001 From: "M. Moellney" Date: Sat, 19 Mar 2016 22:00:32 +0100 Subject: Fix qSetMessagePattern to have many time/backtrace parts The previous implementation overwrote multiple 'time' parts in the qSetMessagePattern with the last setting in the pattern line. %{time}%{time process}%{time boot} ended up to be output as if %{time boot}%{time boot}%{time boot} was set. This fix keeps the arguments of each individual 'time' part. The same holds for multiple 'backtrace' parts. The previouse implementation overwrote multiple 'backtrace' arguments with the arguments of the last occurrence. This fix keeps the individual arguments for the 'process' parts. The individual arguments are applied in qFormatLogMessage. A new test to verify the individual 'time' arguments application is added, too. Task-number: QTBUG-51944 Change-Id: Ib757614a482c5f31ed0a61b550daa2eea4b907b4 Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index a65a72313f..618806f3cd 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -779,6 +779,17 @@ void tst_qmessagehandler::qMessagePattern_data() << true << (QList() << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + "/qDebug")); + QTest::newRow("time-time") << "/%{time yyyy - MM - d}/%{time dd-MM-yy}/%{message}" + << true << (QList() + << ('/' + QDateTime::currentDateTime().toString("yyyy - MM - d").toUtf8() + + '/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + + "/qDebug")); + + QTest::newRow("skipped-time-shown-time") + << "/%{if-warning}%{time yyyy - MM - d}%{endif}%{if-debug}%{time dd-MM-yy}%{endif}/%{message}" + << true << (QList() + << ('/' + QDateTime::currentDateTime().toString("dd-MM-yy").toUtf8() + "/qDebug")); + // %{time} should have a padding of 6 so if it takes less than 10 seconds to show // the first message, there should be 5 spaces QTest::newRow("time-process") << "<%{time process}>%{message}" << true << (QList() -- cgit v1.2.3 From f64640f44163d868e3d101c3b0ba41d33147a5be Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Tue, 1 Mar 2016 09:07:11 +0100 Subject: Allow to style arrows drawn with drawPrimitive in QCommonStyle. Its currently not possible to style the arrows with QCommonStyle because drawPrimitive from QCommonStyle is called instead from the proxy. Change-Id: I910b13df110601cb18578bc16edfa5ddaa17bbd2 Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/widgets/styles/qstyle/tst_qstyle.cpp | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 21369d4520..dafa95fb25 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp @@ -131,6 +131,8 @@ private slots: void defaultFont(); void testDrawingShortcuts(); void testFrameOnlyAroundContents(); + + void testProxyCalled(); private: void lineUpLayoutTest(QStyle *); QWidget *testWidget; @@ -808,5 +810,51 @@ void tst_QStyle::testFrameOnlyAroundContents() } +class ProxyTest: public QProxyStyle +{ + Q_OBJECT +public: + ProxyTest(QStyle *style = 0) + :QProxyStyle(style) + , called(false) + {} + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE { + called = true; + return QProxyStyle::drawPrimitive(pe, opt, p, w); + } + mutable bool called; +}; + + +void tst_QStyle::testProxyCalled() +{ + QToolButton b; + b.setArrowType(Qt::DownArrow); + QStyleOptionToolButton opt; + opt.init(&b); + opt.features |= QStyleOptionToolButton::Arrow; + QPixmap surface(QSize(200, 200)); + QPainter painter(&surface); + + QStringList keys = QStyleFactory::keys(); + QVector styles; + styles.reserve(keys.size() + 1); + + styles << new QCommonStyle(); + + Q_FOREACH (const QString &key, keys) { + styles << QStyleFactory::create(key); + } + + Q_FOREACH (QStyle *style, styles) { + ProxyTest testStyle; + testStyle.setBaseStyle(style); + style->drawControl(QStyle::CE_ToolButtonLabel, &opt, &painter, &b); + QVERIFY(testStyle.called); + delete style; + } +} + QTEST_MAIN(tst_QStyle) #include "tst_qstyle.moc" -- cgit v1.2.3 From 717724b17ac8e12ab06fe3820c0ac6349e971814 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 29 Feb 2016 14:32:11 +0100 Subject: Purge sRGB chunks from PNGs in tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subjects each *.png file that matched grep -law "sRGB" to: pngcrush -ow -brute -rem allb -reduce (Two needed -force but did get smaller.) Change-Id: Ia030f0bc1d3617ba716bcc26677ff919ef58423c Reviewed-by: Topi Reiniö --- .../qpixmap/convertFromToHICON/icon_8bpp_16x16.png | Bin 1454 -> 1335 bytes .../qpixmap/convertFromToHICON/icon_8bpp_32x32.png | Bin 1721 -> 1577 bytes .../qpixmap/convertFromToHICON/icon_8bpp_48x48.png | Bin 1967 -> 1778 bytes .../image/qpixmap/loadFromData/designer_argb32.png | Bin 4189 -> 2874 bytes .../loadFromData/designer_indexed8_no_alpha.png | Bin 2431 -> 2365 bytes .../loadFromData/designer_indexed8_with_alpha.png | Bin 1405 -> 1339 bytes tests/auto/other/lancelot/images/alpha2x2.png | Bin 169 -> 78 bytes tests/auto/other/lancelot/images/solid2x2.png | Bin 169 -> 75 bytes tests/auto/widgets/effects/qpixmapfilter/noise.png | Bin 7517 -> 6305 bytes .../auto/widgets/widgets/qcombobox/qtlogoinverted.png | Bin 2827 -> 2297 bytes 10 files changed, 0 insertions(+), 0 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png index e9a995e19e..03b1a65f70 100644 Binary files a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png and b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_16x16.png differ diff --git a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png index 41ef57f94d..0ef47c556d 100644 Binary files a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png and b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_32x32.png differ diff --git a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png index 35d60d138b..2060854802 100644 Binary files a/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png and b/tests/auto/gui/image/qpixmap/convertFromToHICON/icon_8bpp_48x48.png differ diff --git a/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png index 55d8247cfc..a35316b9c9 100644 Binary files a/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png and b/tests/auto/gui/image/qpixmap/loadFromData/designer_argb32.png differ diff --git a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png index 28cd2f06d1..3dd2115df1 100644 Binary files a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png and b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_no_alpha.png differ diff --git a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png index 09735a9752..99cbf4f13a 100644 Binary files a/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png and b/tests/auto/gui/image/qpixmap/loadFromData/designer_indexed8_with_alpha.png differ diff --git a/tests/auto/other/lancelot/images/alpha2x2.png b/tests/auto/other/lancelot/images/alpha2x2.png index 67ecc04286..8e99feb4cc 100644 Binary files a/tests/auto/other/lancelot/images/alpha2x2.png and b/tests/auto/other/lancelot/images/alpha2x2.png differ diff --git a/tests/auto/other/lancelot/images/solid2x2.png b/tests/auto/other/lancelot/images/solid2x2.png index ad67cd3e12..f34562f964 100644 Binary files a/tests/auto/other/lancelot/images/solid2x2.png and b/tests/auto/other/lancelot/images/solid2x2.png differ diff --git a/tests/auto/widgets/effects/qpixmapfilter/noise.png b/tests/auto/widgets/effects/qpixmapfilter/noise.png index 1bebaf528e..c8433602b2 100644 Binary files a/tests/auto/widgets/effects/qpixmapfilter/noise.png and b/tests/auto/widgets/effects/qpixmapfilter/noise.png differ diff --git a/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png b/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png index 61efb2f001..af150a697b 100644 Binary files a/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png and b/tests/auto/widgets/widgets/qcombobox/qtlogoinverted.png differ -- cgit v1.2.3 From cd46a2daf57dea2e0b661d72f6eb2171079797ba Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Fri, 22 Jan 2016 14:24:00 +0200 Subject: Unify license header usage. Update files using old header.LGPL3 to header.LGPL Update files using old FDL template to use new one Update files using old BSD template to use new one Change-Id: I36a78272516f9953d02956522f285b40adfc8915 Reviewed-by: Lars Knoll --- .../corelib/global/qglobalstatic/tst_qglobalstatic.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp index d4b9c3f1f0..1253a32f97 100644 --- a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp +++ b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp @@ -1,13 +1,23 @@ /**************************************************************************** ** -** Copyright (C) 2011 Thiago Macieira +** Copyright (C) 2016 Thiago Macieira ** Copyright (C) 2016 Intel Corporation. -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are -- cgit v1.2.3 From b169b5a4f36c4c8bd0acb5d91dec2e5d3f1e056d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 23 Mar 2016 14:44:31 +0100 Subject: QPlainTextEdit: Take vertical offset into account when answering input method queries. Determine offset point to similar to QTextEdit::inputMethodQuery() and add an autotest. Task-number: QTBUG-51923 Change-Id: I8232eb348063e2cd95d0632fe74a6eb30c897eda Reviewed-by: Marc Mutz --- .../widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index 2145260013..d466489acb 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -154,6 +154,7 @@ private slots: #ifndef QT_NO_CONTEXTMENU void contextMenu(); #endif + void inputMethodCursorRect(); private: void createSelection(); @@ -1727,5 +1728,17 @@ void tst_QPlainTextEdit::contextMenu() } #endif // QT_NO_CONTEXTMENU +// QTBUG-51923: Verify that the cursor rectangle returned by the input +// method query correctly reflects the viewport offset. +void tst_QPlainTextEdit::inputMethodCursorRect() +{ + ed->setPlainText("Line1\nLine2Line3\nLine3"); + ed->moveCursor(QTextCursor::End); + const QRectF cursorRect = ed->cursorRect(); + const QVariant cursorRectV = ed->inputMethodQuery(Qt::ImCursorRectangle); + QCOMPARE(cursorRectV.type(), QVariant::RectF); + QCOMPARE(cursorRectV.toRect(), cursorRect.toRect()); +} + QTEST_MAIN(tst_QPlainTextEdit) #include "tst_qplaintextedit.moc" -- cgit v1.2.3 From 88fae806a85ea1bcff2cecbd86f63f396631c120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Fri, 25 Mar 2016 02:48:14 +0100 Subject: QtWidgets: Add autotests for Qt::WA_OutsideWSRange flag Task-number: QTBUG-48321 Task-number: QTBUG-49445 Task-number: QTBUG-51788 Change-Id: I6c04919ff788cad684df69d0aee73d86fd985bb9 Reviewed-by: Dmitry Shachnev Reviewed-by: Ulf Hermann --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 66 +++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index fb3e644a5c..1c2a74109f 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -461,6 +461,8 @@ private slots: void qmlSetParentHelper(); + void testForOutsideWSRangeFlag(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -10549,5 +10551,69 @@ void tst_QWidget::qmlSetParentHelper() #endif } +void tst_QWidget::testForOutsideWSRangeFlag() +{ + // QTBUG-49445 + { + QWidget widget; + widget.resize(0, 0); + widget.show(); + QTest::qWait(100); // Wait for a while... + QVERIFY(!widget.windowHandle()->isExposed()); // The window should not be visible + QVERIFY(widget.isVisible()); // The widget should be in visible state + } + { + QWidget widget; + + QWidget native(&widget); + native.setAttribute(Qt::WA_NativeWindow); + native.resize(0, 0); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(!native.windowHandle()->isExposed()); + } + { + QWidget widget; + QWidget native(&widget); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(native.isVisible()); + + native.resize(0, 0); + native.setAttribute(Qt::WA_NativeWindow); + QTest::qWait(100); // Wait for a while... + QVERIFY(!native.windowHandle()->isExposed()); + } + + // QTBUG-48321 + { + QWidget widget; + + QWidget native(&widget); + native.setAttribute(Qt::WA_NativeWindow); + + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + QVERIFY(native.windowHandle()->isExposed()); + + native.resize(0, 0); + QTest::qWait(100); // Wait for a while... + QVERIFY(!native.windowHandle()->isExposed()); + } + + // QTBUG-51788 + { + QWidget widget; + widget.setLayout(new QGridLayout); + widget.layout()->addWidget(new QLineEdit); + widget.resize(0, 0); + widget.show(); + // The layout should change the size, so the widget must be visible! + QVERIFY(QTest::qWaitForWindowExposed(&widget)); + } +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" -- cgit v1.2.3 From 086317d72a6b6964bf26df4ebedcb6d321b2d56b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 23 Mar 2016 14:48:09 +0100 Subject: QTextEdit::inputMethodQuery(): Preserve types when applying offset. The old code converted QRectF into QRect when applying the offset. Change the offset point to QPointF and change the conversions accordingly. Add an autotest similar to that of QPlainTextEdit. This minimizes rounding errors and prevents conversions since the input method logic mostly uses qreal. Task-number: QTBUG-51923 Change-Id: I0c2f80ccae028d8bbbb97ec603f8782f69959c76 Reviewed-by: Marc Mutz --- tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 0cc812cbca..b81e4df123 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -191,6 +191,7 @@ private slots: void inputMethodQuery(); void inputMethodQueryImHints_data(); void inputMethodQueryImHints(); + void inputMethodCursorRect(); void highlightLongLine(); @@ -2473,6 +2474,18 @@ void tst_QTextEdit::inputMethodQueryImHints() QCOMPARE(static_cast(value.toInt()), hints); } +// QTBUG-51923: Verify that the cursor rectangle returned by the input +// method query correctly reflects the viewport offset. +void tst_QTextEdit::inputMethodCursorRect() +{ + ed->setPlainText("Line1\nLine2Line3\nLine3"); + ed->moveCursor(QTextCursor::End); + const QRectF cursorRect = ed->cursorRect(); + const QVariant cursorRectV = ed->inputMethodQuery(Qt::ImCursorRectangle); + QCOMPARE(cursorRectV.type(), QVariant::RectF); + QCOMPARE(cursorRectV.toRect(), cursorRect.toRect()); +} + void tst_QTextEdit::highlightLongLine() { QTextEdit edit; -- cgit v1.2.3 From 9bc352e38d6b03fbb12a359a7bdfc8d22aa7e192 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Wed, 23 Mar 2016 19:26:02 +0100 Subject: Enable cmake auto tests for -no-gui This change disables tests which require QtGui. Change-Id: Ib647afd086f54536054cb4c0cde5696d762ee8c4 Reviewed-by: Stephen Kelly Reviewed-by: Kevin Funk --- tests/auto/auto.pro | 2 +- tests/auto/cmake/CMakeLists.txt | 7 ++++++- tests/auto/cmake/test_testlib_definitions/CMakeLists.txt | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index cc916edbad..f7c38e4422 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -24,7 +24,7 @@ ios: SUBDIRS = corelib gui wince: SUBDIRS -= printsupport cross_compile: SUBDIRS -= tools !qtHaveModule(opengl): SUBDIRS -= opengl -!qtHaveModule(gui): SUBDIRS -= gui cmake installed_cmake +!qtHaveModule(gui): SUBDIRS -= gui !qtHaveModule(widgets): SUBDIRS -= widgets !qtHaveModule(printsupport): SUBDIRS -= printsupport !qtHaveModule(concurrent): SUBDIRS -= concurrent diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 1abbef0d68..c780096854 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -116,13 +116,18 @@ endif() set(qt_module_includes Core QObject - Gui QImage Network QHostInfo Sql QSqlError Test QTestEventList Xml QDomDocument ) +if (NOT NO_GUI) + list(APPEND qt_module_includes + Gui QImage + ) +endif() + if (NOT NO_WIDGETS) list(APPEND qt_module_includes Widgets QWidget diff --git a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt index cc54bf5bc3..6fe7e56d24 100644 --- a/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt +++ b/tests/auto/cmake/test_testlib_definitions/CMakeLists.txt @@ -34,7 +34,9 @@ macro(test_testlib_project _module) endmacro() add_subdirectory(core_only) -add_subdirectory(gui) +if(NOT NO_GUI) + add_subdirectory(gui) +endif() if(NOT NO_WIDGETS) add_subdirectory(widgets) endif() -- cgit v1.2.3 From 91f8c9cc70bbfb752811cd29945fb37ff863d524 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Fri, 18 Mar 2016 10:49:43 +0100 Subject: Remove the traces of the discontinued android-no-sdk platform Cleaning out the workarounds for the discontinued "Embedded Android" platform of Boot2Qt. Change-Id: I0ff9d770e82a43457fb7e5da0428f4597ead4038 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/io/qdatastream/qdatastream.pro | 2 +- tests/auto/corelib/io/qdir/qdir.pro | 2 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 6 +++--- tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp | 2 +- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 4 ++-- .../auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 2 +- tests/auto/corelib/io/qiodevice/qiodevice.pro | 2 +- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 2 +- tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp | 2 +- tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro | 2 +- tests/auto/corelib/io/qresourceengine/qresourceengine.pro | 2 +- tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp | 6 +++--- tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp | 2 +- tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro | 2 +- tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp | 8 ++++---- tests/auto/corelib/kernel/qtranslator/qtranslator.pro | 2 +- tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp | 2 +- tests/auto/corelib/tools/qbytearray/qbytearray.pro | 2 +- tests/auto/corelib/tools/qchar/qchar.pro | 2 +- tests/auto/corelib/tools/qcollator/tst_qcollator.cpp | 2 +- .../corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp | 6 +++--- .../auto/corelib/tools/qcryptographichash/qcryptographichash.pro | 2 +- .../corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro | 2 +- tests/auto/gui/image/qimage/qimage.pro | 2 +- tests/auto/gui/image/qimagereader/qimagereader.pro | 2 +- tests/auto/gui/image/qimagewriter/qimagewriter.pro | 2 +- tests/auto/gui/painting/qpainter/qpainter.pro | 2 +- .../qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp | 2 +- tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp | 2 +- .../widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp | 6 +++--- tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro | 2 +- tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp | 4 ++-- tests/auto/widgets/kernel/qlayout/qlayout.pro | 2 +- tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 2 +- tests/auto/widgets/styles/qstyle/qstyle.pro | 2 +- 35 files changed, 48 insertions(+), 48 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 961e1933de..291b3eb611 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -5,7 +5,7 @@ SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/io/qdir/qdir.pro b/tests/auto/corelib/io/qdir/qdir.pro index e8f5d1079a..e5739f7e0a 100644 --- a/tests/auto/corelib/io/qdir/qdir.pro +++ b/tests/auto/corelib/io/qdir/qdir.pro @@ -8,7 +8,7 @@ TESTDATA += testdir testData searchdir resources entrylist types tst_qdir.cpp contains(CONFIG, builtin_testdata): DEFINES += BUILTIN_TESTDATA -android:!android-no-sdk { +android { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 5046f5abf4..703e9c5b07 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -222,13 +222,13 @@ private: Q_DECLARE_METATYPE(tst_QDir::UncHandling) tst_QDir::tst_QDir() -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) : m_dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)) #elif !defined(BUILTIN_TESTDATA) : m_dataPath(QFileInfo(QFINDTESTDATA("testData")).absolutePath()) #endif { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString resourceSourcePath = QStringLiteral(":/android_testdata/"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -2140,7 +2140,7 @@ void tst_QDir::equalityOperator_data() QString pathinroot(QDir::rootPath() + QLatin1String("assets/..")); #elif defined (Q_OS_WIN) QString pathinroot("c:/windows/.."); -#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#elif defined(Q_OS_ANDROID) QString pathinroot("/system/.."); #elif defined(Q_OS_HAIKU) QString pathinroot("/boot/.."); diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 9727ccb407..0fbce74055 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -118,7 +118,7 @@ private: void tst_QDirIterator::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString testdata_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); QString resourceSourcePath = QStringLiteral(":/"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 4362bace8c..8d62a38e6b 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1199,7 +1199,7 @@ void tst_QFileInfo::fileTimes() QEXPECT_FAIL("", "WinRT does not allow timestamp handling change in the filesystem due to sandboxing", Continue); #elif defined(Q_OS_QNX) QEXPECT_FAIL("", "QNX uses the noatime filesystem option", Continue); -#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#elif defined(Q_OS_ANDROID) if (fileInfo.lastRead() <= beforeRead) QEXPECT_FAIL("", "Android may use relatime or noatime on mounts", Continue); #endif @@ -1654,7 +1654,7 @@ void tst_QFileInfo::isWritable() void tst_QFileInfo::isExecutable() { QString appPath = QCoreApplication::applicationDirPath(); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) appPath += "/libtst_qfileinfo.so"; #else appPath += "/tst_qfileinfo"; diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 5c9de8abb9..187f72d095 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -87,7 +87,7 @@ tst_QFileSystemWatcher::tst_QFileSystemWatcher() m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); #endif // QT_NO_FILESYSTEMWATCHER -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); #endif } diff --git a/tests/auto/corelib/io/qiodevice/qiodevice.pro b/tests/auto/corelib/io/qiodevice/qiodevice.pro index 78f5b5e75d..945022a289 100644 --- a/tests/auto/corelib/io/qiodevice/qiodevice.pro +++ b/tests/auto/corelib/io/qiodevice/qiodevice.pro @@ -6,7 +6,7 @@ SOURCES = tst_qiodevice.cpp TESTDATA += tst_qiodevice.cpp MOC_DIR=tmp -android:!android-no-sdk: { +android { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 8d5a4055b8..30eaa5aab9 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -66,7 +66,7 @@ private: void tst_QIODevice::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QVERIFY(QFileInfo(QStringLiteral("./tst_qiodevice.cpp")).exists() || QFile::copy(QStringLiteral(":/tst_qiodevice.cpp"), QStringLiteral("./tst_qiodevice.cpp"))); #endif diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp index 851c104c6a..00b82cb377 100644 --- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp +++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp @@ -70,7 +70,7 @@ public: void tst_QLockFile::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("This test requires deploying and running external console applications"); #elif defined(QT_NO_PROCESS) QSKIP("This test requires QProcess support"); diff --git a/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro index a311173c0e..321420c2df 100644 --- a/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro +++ b/tests/auto/corelib/io/qloggingregistry/qloggingregistry.pro @@ -8,7 +8,7 @@ SOURCES += tst_qloggingregistry.cpp OTHER_FILES += qtlogging.ini TESTDATA += qtlogging.ini -android:!android-no-sdk: { +android { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro index e8b82b4df7..a39de3c4d5 100644 --- a/tests/auto/corelib/io/qresourceengine/qresourceengine.pro +++ b/tests/auto/corelib/io/qresourceengine/qresourceengine.pro @@ -17,6 +17,6 @@ TESTDATA += \ testqrc/* GENERATED_TESTDATA = $${runtime_resource.target} -android:!android-no-sdk { +android { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index 5c51e69add..561ab193c6 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -36,7 +36,7 @@ class tst_QResourceEngine: public QObject public: tst_QResourceEngine() -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) : m_runtimeResourceRcc(QFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/runtime_resource.rcc")).absoluteFilePath()) #else : m_runtimeResourceRcc(QFINDTESTDATA("runtime_resource.rcc")) @@ -63,7 +63,7 @@ private: void tst_QResourceEngine::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString sourcePath(QStringLiteral(":/android_testdata/")); QString dataPath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); @@ -120,7 +120,7 @@ void tst_QResourceEngine::checkStructure_data() << QLatin1String("test") << QLatin1String("withoutslashes"); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) rootContents.insert(1, QLatin1String("android_testdata")); #endif diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index 410f512a77..72a57c5905 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -230,7 +230,7 @@ void tst_QTemporaryDir::nonWritableCurrentDir() { #ifdef Q_OS_UNIX -# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +# if defined(Q_OS_ANDROID) const char nonWritableDir[] = "/data"; # else const char nonWritableDir[] = "/home"; diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index 8f250e4568..a89e5c66ff 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -5,6 +5,6 @@ SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp RESOURCES += qtemporaryfile.qrc -android:!android-no-sdk { +android { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index 53c64166c4..9645ca9ba2 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -93,7 +93,7 @@ void tst_QTemporaryFile::initTestCase() QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -290,7 +290,7 @@ void tst_QTemporaryFile::nonWritableCurrentDir() ChdirOnReturn cor(QDir::currentPath()); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QDir::setCurrent("/data"); #else QDir::setCurrent("/home"); @@ -466,7 +466,7 @@ void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX -# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +# if defined(Q_OS_ANDROID) ChdirOnReturn cor(QDir::currentPath()); QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); # endif @@ -675,7 +675,7 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn("valid"); QTest::addColumn("content"); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); #else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index 63189e5562..e673278920 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -4,6 +4,6 @@ QT = core testlib SOURCES = tst_qtranslator.cpp RESOURCES += qtranslator.qrc -android:!android-no-sdk: RESOURCES += android_testdata.qrc +android: RESOURCES += android_testdata.qrc else: TESTDATA += dependencies_la.qm hellotr_la.qm msgfmt_from_po.qm diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 59ea484355..66971af7b4 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -64,7 +64,7 @@ tst_QTranslator::tst_QTranslator() void tst_QTranslator::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index a4501611d6..f59cdf3524 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -10,7 +10,7 @@ mac { LIBS += -framework Foundation } -android: !android-no-sdk { +android { RESOURCES += \ android_testdata.qrc } diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index 771e4290b8..012e591298 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -5,7 +5,7 @@ SOURCES = tst_qchar.cpp TESTDATA += data/NormalizationTest.txt -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index f2f1038dc2..d09910fd5c 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -165,7 +165,7 @@ void tst_QCollator::compare() QCollator collator(locale); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) if (collator.locale() != QLocale()) QSKIP("Posix implementation of collation only supports default locale"); #endif diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index f3f335cb92..9552152136 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -504,7 +504,7 @@ void tst_QCommandLineParser::testVersionOption() #ifdef Q_OS_WINCE QSKIP("Reading and writing to a process is not supported on Qt/CE"); #endif -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -573,7 +573,7 @@ void tst_QCommandLineParser::testHelpOption() #ifdef Q_OS_WINCE QSKIP("Reading and writing to a process is not supported on Qt/CE"); #endif -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("Deploying executable applications to file system on Android not supported."); #endif @@ -620,7 +620,7 @@ void tst_QCommandLineParser::testQuoteEscaping() { #ifdef QT_NO_PROCESS QSKIP("This test requires QProcess support"); -#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#elif defined(Q_OS_ANDROID) QSKIP("Deploying executable applications to file system on Android not supported."); #else QCoreApplication app(empty_argc, empty_argv); diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro index 15a57c692e..7fead5938b 100644 --- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -5,7 +5,7 @@ SOURCES = tst_qcryptographichash.cpp TESTDATA += data/* -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 9d26ec1fd5..8e0216b175 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,7 +5,7 @@ SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/gui/image/qimage/qimage.pro b/tests/auto/gui/image/qimage/qimage.pro index d32e84c0d7..36d64a275f 100644 --- a/tests/auto/gui/image/qimage/qimage.pro +++ b/tests/auto/gui/image/qimage/qimage.pro @@ -5,6 +5,6 @@ SOURCES += tst_qimage.cpp QT += core-private gui-private testlib contains(QT_CONFIG, c++11): CONFIG += c++11 -android:!android-no-sdk:RESOURCES+=qimage.qrc +android: RESOURCES+=qimage.qrc TESTDATA += images/* diff --git a/tests/auto/gui/image/qimagereader/qimagereader.pro b/tests/auto/gui/image/qimagereader/qimagereader.pro index 2ab06abe83..3d35bf59da 100644 --- a/tests/auto/gui/image/qimagereader/qimagereader.pro +++ b/tests/auto/gui/image/qimagereader/qimagereader.pro @@ -5,7 +5,7 @@ MOC_DIR=tmp QT += core-private gui-private network testlib RESOURCES += qimagereader.qrc -android: !android-no-sdk { +android { RESOURCES += android_testdata.qrc } diff --git a/tests/auto/gui/image/qimagewriter/qimagewriter.pro b/tests/auto/gui/image/qimagewriter/qimagewriter.pro index 31184bffdb..34adedd187 100644 --- a/tests/auto/gui/image/qimagewriter/qimagewriter.pro +++ b/tests/auto/gui/image/qimagewriter/qimagewriter.pro @@ -3,5 +3,5 @@ TARGET = tst_qimagewriter QT += testlib SOURCES += tst_qimagewriter.cpp MOC_DIR=tmp -android:!android-no-sdk:RESOURCES+= qimagewriter.qrc +android: RESOURCES+= qimagewriter.qrc TESTDATA += images/* diff --git a/tests/auto/gui/painting/qpainter/qpainter.pro b/tests/auto/gui/painting/qpainter/qpainter.pro index d4f1d43a74..0d3899ee92 100644 --- a/tests/auto/gui/painting/qpainter/qpainter.pro +++ b/tests/auto/gui/painting/qpainter/qpainter.pro @@ -9,7 +9,7 @@ SOURCES += tst_qpainter.cpp TESTDATA += drawEllipse/* drawLine_rop_bitmap/* drawPixmap_rop/* drawPixmap_rop_bitmap/* \ task217400.png -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp index 4b4e456882..1fcb77c51b 100644 --- a/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp +++ b/tests/auto/other/qprocess_and_guieventloop/tst_qprocess_and_guieventloop.cpp @@ -42,7 +42,7 @@ void tst_QProcess_and_GuiEventLoop::waitForAndEventLoop() { #if defined(QT_NO_PROCESS) QSKIP("QProcess not supported"); -#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#elif defined(Q_OS_ANDROID) QSKIP("Not supported on Android"); #else diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 5ee015ac64..78d0372ac0 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -84,7 +84,7 @@ void tst_QSidebar::addUrls() QAbstractItemModel *model = qsidebar.model(); QDir testDir = QDir::home(); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) // temp and home is the same directory on Android testDir.mkdir(QStringLiteral("test")); QVERIFY(testDir.cd(QStringLiteral("test"))); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 0ae69ea59f..a346bb9d1f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2675,7 +2675,7 @@ void tst_QGraphicsScene::render() void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("Test only works on platforms with resizable windows"); #endif @@ -2754,7 +2754,7 @@ protected: void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("Test fails on some Android devices (QTBUG-44430)"); #endif @@ -4027,7 +4027,7 @@ void tst_QGraphicsScene::polishItems2() void tst_QGraphicsScene::isActive() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("Fails on Android (QTBUG-44430)"); #endif diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index f1bc968b88..5190598701 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -19,7 +19,7 @@ android|wince { DEFINES += SRCDIR=\\\"$$PWD/\\\" } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index e3a2d3cc99..06019d4555 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -111,7 +111,7 @@ void tst_QDirModel::getSetCheck() void tst_QDirModel::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString dataPath = SRCDIR; QString resourceSourcePath = QStringLiteral(":/android_testdata"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); @@ -613,7 +613,7 @@ void tst_QDirModel::task196768_sorting() view.setSortingEnabled(true); index2 = model.index(path); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QEXPECT_FAIL("", "QTBUG-43818", Continue); #endif diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 8bdbde9282..2213767950 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -12,7 +12,7 @@ wince* { TESTDATA += baseline/* } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index d687c646ff..47fc002196 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -341,7 +341,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("Test does not work on platforms which default to showMaximized()"); #endif diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 4d7473f068..50445b9a45 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -9,7 +9,7 @@ wince* { DEPLOYMENT += addPixmap } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } -- cgit v1.2.3 From a4e2f2e687ca7aec88ecf82f72d42ac61e17a5b9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 4 Mar 2016 13:50:18 +0100 Subject: Fix possible crash in QImage::pixel() QImage::pixel() assumed that the color table was valid for the values in the bitmap. This was always wrong for indexed images with explicit no color table set and was wrong for mono images that were constructed from preexisting data. For mono images, we default to a black/white color table, like we do when constructing with uninitialized data. For indexed image, we always default to no color table, but instead of crashing in pixel(), we warn and return an undefined value. [ChangeLog][QtGui][Image] Fixed possible crash in QImage::pixel() for mono or indexed images. Change-Id: Ieaf19c03984badddfd06e1855a7e287b862adc70 Task-number: QTBUG-50745 Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Gunnar Sletta --- tests/auto/gui/image/qimage/tst_qimage.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index 23ddfbdd58..e8e1cd1896 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -197,6 +197,7 @@ private slots: void metadataPassthrough(); void pixelColor(); + void pixel(); private: const QString m_prefix; @@ -3038,5 +3039,33 @@ void tst_QImage::pixelColor() QCOMPARE(t.pixel(0,0), argb32pm.pixel(0,0)); } +void tst_QImage::pixel() +{ + { + QImage mono(1, 1, QImage::Format_Mono); + QImage monolsb(1, 1, QImage::Format_MonoLSB); + QImage indexed(1, 1, QImage::Format_Indexed8); + + mono.fill(0); + monolsb.fill(0); + indexed.fill(0); + + QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black)); + QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black)); + indexed.pixel(0, 0); // Don't crash + } + + { + uchar a = 0; + QImage mono(&a, 1, 1, QImage::Format_Mono); + QImage monolsb(&a, 1, 1, QImage::Format_MonoLSB); + QImage indexed(&a, 1, 1, QImage::Format_Indexed8); + + QCOMPARE(QColor(mono.pixel(0, 0)), QColor(Qt::black)); + QCOMPARE(QColor(monolsb.pixel(0, 0)), QColor(Qt::black)); + indexed.pixel(0, 0); // Don't crash + } +} + QTEST_GUILESS_MAIN(tst_QImage) #include "tst_qimage.moc" -- cgit v1.2.3 From 342290888f40a6f3317c0eaef07c20a71ac0eeb1 Mon Sep 17 00:00:00 2001 From: Milla Pohjanheimo Date: Tue, 29 Mar 2016 07:05:30 +0300 Subject: Check that window has been painted The test is preventing us to take RHEL 7.1 in the CI for Qt 5.7. Changed the paintEvent() test to be less strict about the paintCount. Task-number: QTBUG-51809 Change-Id: I84f797442e38c66dc23862e92eda6db08bcac368 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index ac671743f4..c93fc1288f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1296,7 +1296,7 @@ void tst_QGraphicsProxyWidget::paintEvent() proxy.paintCount = 0; w->update(); - QTRY_COMPARE(proxy.paintCount, 1); //the widget should have been painted now + QTRY_VERIFY(proxy.paintCount >= 1); //the widget should have been painted now } -- cgit v1.2.3 From 479ee4fa461e3c9bd71480d8e7a0bcabced52919 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 30 Mar 2016 18:20:40 +0200 Subject: moc: bail out early on missing or invalid options file If moc is invoked with the @ argument and no options file is specified or the options file cannot be read, do not try to parse the empty arguments list. Otherwise QCommandLineParser will print an additional error message that is of no value for the user. Task-number: QTBUG-51847 Change-Id: I9aa1eb20a44097b553123be8bc6fded87473a03a Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/tools/moc/tst_moc.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 5c16c7a48f..b3f9a9f85f 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -627,6 +627,8 @@ private slots: void unnamedNamespaceObjectsAndGadgets(); void veryLongStringData(); void gadgetHierarchy(); + void optionsFileError_data(); + void optionsFileError(); signals: void sigWithUnsignedArg(unsigned foo); @@ -3501,6 +3503,31 @@ void tst_Moc::gadgetHierarchy() QCOMPARE(GrandParentGadget::DerivedGadget::staticMetaObject.superClass(), &GrandParentGadget::BaseGadget::staticMetaObject); } +void tst_Moc::optionsFileError_data() +{ + QTest::addColumn("optionsArgument"); + QTest::newRow("no filename") << QStringLiteral("@"); + QTest::newRow("nonexistent file") << QStringLiteral("@letshuntasnark"); +} + +void tst_Moc::optionsFileError() +{ +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if !defined(QT_NO_PROCESS) + QFETCH(QString, optionsArgument); + QProcess p; + p.start(m_moc, QStringList(optionsArgument)); + QVERIFY(p.waitForFinished()); + QCOMPARE(p.exitCode(), 1); + QVERIFY(p.readAllStandardOutput().isEmpty()); + const QByteArray err = p.readAllStandardError(); + QVERIFY(err.contains("moc: ")); + QVERIFY(!err.contains("QCommandLineParser")); +#endif +} + QTEST_MAIN(tst_Moc) // the generated code must compile with QT_NO_KEYWORDS -- cgit v1.2.3 From ea122fa9e30b78af6b7738284f33451741638444 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 31 Mar 2016 11:23:24 +0200 Subject: Fixup for text labels in lancelot graphics test Some strings were drawn with a different size or scaling than what the string itself said, causing confusion. Change-Id: I4b187cba6d467cfa0900576bdf451052baa806e6 Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/other/lancelot/scripts/statictext.qps | 20 ++++++++++---------- tests/auto/other/lancelot/scripts/text.qps | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/other/lancelot/scripts/statictext.qps b/tests/auto/other/lancelot/scripts/statictext.qps index c5ddda197f..6b7b97d8fa 100644 --- a/tests/auto/other/lancelot/scripts/statictext.qps +++ b/tests/auto/other/lancelot/scripts/statictext.qps @@ -9,7 +9,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -25,7 +25,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "alpha sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "alpha sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -43,7 +43,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "scaled sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "scaled sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -61,7 +61,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 40 "flipped sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 60 "flipped sansserif 12pt, bold" setFont "sansserif" 10 bold italic @@ -75,16 +75,16 @@ save rotate 185 setFont "sansserif" 10 normal - drawStaticText 0 20 "scaled sansserif 10pt, normal" + drawStaticText 0 20 "rotated sansserif 10pt, normal" setFont "sansserif" 12 normal - drawStaticText 0 40 "scaled sansserif 12pt, normal" + drawStaticText 0 40 "rotated sansserif 12pt, normal" - setFont "sansserif" 10 bold - drawStaticText 0 60 "scaled sansserif 12pt, bold" + setFont "sansserif" 12 bold + drawStaticText 0 60 "rotated sansserif 12pt, bold" setFont "sansserif" 10 bold italic - drawStaticText 0 80 "scaled sansserif 10pt, bold italic" + drawStaticText 0 80 "rotated sansserif 10pt, bold italic" restore translate 0 100 @@ -100,7 +100,7 @@ save setFont "sansserif" 12 normal drawStaticText 0 20 "gradient sansserif 12pt, normal" - setFont "sansserif" 10 bold + setFont "sansserif" 12 bold drawStaticText 0 40 "gradient sansserif 12pt, bold" setFont "sansserif" 10 bold italic diff --git a/tests/auto/other/lancelot/scripts/text.qps b/tests/auto/other/lancelot/scripts/text.qps index 169549a5bd..1b4fe4f064 100644 --- a/tests/auto/other/lancelot/scripts/text.qps +++ b/tests/auto/other/lancelot/scripts/text.qps @@ -77,16 +77,16 @@ save rotate 185 setFont "sansserif" 10 normal - drawText 0 20 "scaled sansserif 10pt, normal" + drawText 0 20 "rotated sansserif 10pt, normal" setFont "sansserif" 12 normal - drawText 0 40 "scaled sansserif 12pt, normal" + drawText 0 40 "rotated sansserif 12pt, normal" setFont "sansserif" 12 bold - drawText 0 60 "scaled sansserif 12pt, bold" + drawText 0 60 "rotated sansserif 12pt, bold" setFont "sansserif" 10 bold italic - drawText 0 80 "scaled sansserif 10pt, bold italic" + drawText 0 80 "rotated sansserif 10pt, bold italic" restore translate 0 100 -- cgit v1.2.3 From f44d826751a46427ffc35560f990f6aa66855f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Wed, 24 Feb 2016 09:20:56 +0200 Subject: Autotest: Remove blacklistings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing blacklistings from tests that are now passing. Change-Id: I00aa1ce286d3e7715fb4bee4a36d0d77049a29ae Reviewed-by: Simon Hausmann Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Tony Sarajärvi --- tests/auto/corelib/io/qstandardpaths/BLACKLIST | 2 -- tests/auto/gui/kernel/qwindow/BLACKLIST | 2 -- tests/auto/opengl/qgl/BLACKLIST | 2 -- tests/auto/widgets/dialogs/qfontdialog/BLACKLIST | 4 ---- tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST | 6 ------ tests/auto/widgets/kernel/qwidget/BLACKLIST | 3 --- tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST | 2 -- tests/auto/widgets/widgets/qmenu/BLACKLIST | 3 --- 8 files changed, 24 deletions(-) delete mode 100644 tests/auto/corelib/io/qstandardpaths/BLACKLIST delete mode 100644 tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qstandardpaths/BLACKLIST b/tests/auto/corelib/io/qstandardpaths/BLACKLIST deleted file mode 100644 index 8496a620b3..0000000000 --- a/tests/auto/corelib/io/qstandardpaths/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[testRuntimeDirectory] -rhel-7.1 diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index cfbd47745f..a34066dd7c 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -1,5 +1,3 @@ -[testInputEvents] -rhel-7.1 [positioning:default] ubuntu-14.04 [modalWindowPosition] diff --git a/tests/auto/opengl/qgl/BLACKLIST b/tests/auto/opengl/qgl/BLACKLIST index 547a9a2a73..fa7c829b30 100644 --- a/tests/auto/opengl/qgl/BLACKLIST +++ b/tests/auto/opengl/qgl/BLACKLIST @@ -1,5 +1,3 @@ -[] -rhel-7.1 [glWidgetRendering] windows [glFBORendering] diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST index 5fd026537e..669ec50978 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -1,7 +1,3 @@ [task256466_wrongStyle] opensuse-13.1 rhel-7.1 -[setFont] -ubuntu-14.04 -redhatenterpriselinuxworkstation-6.6 -rhel-7.1 diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST b/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST index 14c41711ac..7f55c2dae0 100644 --- a/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST +++ b/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST @@ -1,8 +1,2 @@ [panGesture:Two finger] xcb -[swipeGesture:SmallDirectionChange] -rhel-7.1 -[swipeGesture:Line] -rhel-7.1 -[pinchGesture:Standard] -rhel-7.1 diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 8d18d40e05..4563da8d48 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -32,7 +32,6 @@ osx osx [widgetAt] osx -rhel-7.1 [sheetOpacity] osx [resizeEvent] @@ -65,10 +64,8 @@ osx osx [taskQTBUG_4055_sendSyntheticEnterLeave] osx -rhel-7.1 [syntheticEnterLeave] osx -rhel-7.1 [maskedUpdate] osx [hideWhenFocusWidgetIsChild] diff --git a/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST b/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST deleted file mode 100644 index a10cf663d0..0000000000 --- a/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[setSystemMenu] -rhel-7.1 diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST index dbc3e26837..de49d5ff45 100644 --- a/tests/auto/widgets/widgets/qmenu/BLACKLIST +++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST @@ -1,5 +1,2 @@ [task258920_mouseBorder] osx -rhel-7.1 -[pushButtonPopulateOnAboutToShow] -rhel-7.1 -- cgit v1.2.3 From b7c7beacda529edd642d979064748bdad27b989b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 1 Apr 2016 09:24:51 +0200 Subject: QPointer: add a test for const QPointer People use this, so make sure there's a test for it. I don't expect this test to fail, but static and dynamic checkers should be presented with this use-case, so they have a chance of warning, because certain implementation strategies of QPointer may make this code undefined. Change-Id: I334bd73204ba4e186c4098fc6b7188917407e020 Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp index d7cce4ada4..f3f485297a 100644 --- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp +++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp @@ -59,6 +59,7 @@ private slots: void qvariantCast(); void constPointer(); + void constQPointer(); }; void tst_QPointer::constructors() @@ -402,6 +403,21 @@ void tst_QPointer::constPointer() delete fp.data(); } +void tst_QPointer::constQPointer() +{ + // Check that const QPointers work. It's a bit weird to mark a pointer + // const if its value can change, but the shallow-const principle in C/C++ + // allows this, and people use it, so document it with a test. + // + // It's unlikely that this test will fail in and out of itself, but it + // presents the use-case to static and dynamic checkers that can raise + // a warning (hopefully) should this become an issue. + QObject *o = new QObject(this); + const QPointer p = o; + delete o; + QVERIFY(!p); +} + QTEST_MAIN(tst_QPointer) #include "tst_qpointer.moc" -- cgit v1.2.3 From bedf0367ac580a2e73712be2f4207bb6af9f0226 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 1 Apr 2016 08:32:37 +0200 Subject: QVariant: Fix flags for type-erased associative iterator key The flags here are passed to a private QVariant constructor, and they really represent a boolean - IsPointer or not. Because the flag for the key_type was incorrectly populated with the flag for the value_type, memory would be corrupted when using a mapping type whose value_type is a pointer, but whose key type was not, such as QMap This typo has been there since the concept was introduced in commit v5.2.0-alpha1~807 (Add container access functionality for associative containers in QVariant., 2013-04-05). Task-number: QTBUG-52246 Change-Id: I9ecb13c603015eed2dc2ca43947fa0ecd6be8b5a Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../auto/corelib/kernel/qvariant/tst_qvariant.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index c91bb21399..f2f3baae6b 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -280,6 +280,8 @@ private slots: void compareSanity_data(); void compareSanity(); + void accessSequentialContainerKey(); + private: void dataStream_data(QDataStream::Version version); void loadQVariantFromDataStream(QDataStream::Version version); @@ -4733,5 +4735,30 @@ void tst_QVariant::compareSanity() } } +void tst_QVariant::accessSequentialContainerKey() +{ + QString nameResult; + + { + QMap mapping; + QString name = QString::fromLatin1("Seven"); + mapping.insert(name, Q_NULLPTR); + + QVariant variant = QVariant::fromValue(mapping); + + QAssociativeIterable iterable = variant.value(); + QAssociativeIterable::const_iterator iit = iterable.begin(); + const QAssociativeIterable::const_iterator end = iterable.end(); + for ( ; iit != end; ++iit) { + nameResult += iit.key().toString(); + } + } // Destroy mapping + // Regression test for QTBUG-52246 - no memory corruption/double deletion + // of the string key. + + QCOMPARE(nameResult, QStringLiteral("Seven")); +} + + QTEST_MAIN(tst_QVariant) #include "tst_qvariant.moc" -- cgit v1.2.3