From a591c272820c623e3bfcf0aea39209f4a03d341d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 22 May 2014 16:37:49 +0200 Subject: Stabilize and speed up tst_QGraphicsItem::cursor(). Use QTRY_COMPARE instead of hard-coded timeouts, ensure window is shown. Change-Id: I4f23144ee14150c4fba9c6fbd8c4ee2da472cc75 Reviewed-by: Robin Burchell --- .../qgraphicsitem/tst_qgraphicsitem.cpp | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 84466b92d1..e9aae1ec59 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -141,6 +142,17 @@ static void sendKeyClick(QGraphicsScene *scene, Qt::Key key) sendKeyRelease(scene, key); } +static inline void centerOnScreen(QWidget *w, const QSize &size) +{ + const QPoint offset = QPoint(size.width() / 2, size.height() / 2); + w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); +} + +static inline void centerOnScreen(QWidget *w) +{ + centerOnScreen(w, w->geometry().size()); +} + class EventSpy : public QGraphicsWidget { Q_OBJECT @@ -4211,14 +4223,18 @@ void tst_QGraphicsItem::cursor() item2->setCursor(Qt::PointingHandCursor); QWidget topLevel; + topLevel.resize(250, 150); + centerOnScreen(&topLevel); QGraphicsView view(&scene,&topLevel); view.setFixedSize(200, 100); topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); + QTest::mouseMove(&view, view.rect().center()); QTest::qWait(25); - QCursor cursor = view.viewport()->cursor(); + const Qt::CursorShape viewportShape = view.viewport()->cursor().shape(); { QTest::mouseMove(view.viewport(), QPoint(100, 50)); @@ -4226,9 +4242,7 @@ void tst_QGraphicsItem::cursor() QApplication::sendEvent(view.viewport(), &event); } - QTest::qWait(25); - - QCOMPARE(view.viewport()->cursor().shape(), cursor.shape()); + QTRY_COMPARE(view.viewport()->cursor().shape(), viewportShape); { QTest::mouseMove(view.viewport(), view.mapFromScene(item1->sceneBoundingRect().center())); @@ -4236,7 +4250,7 @@ void tst_QGraphicsItem::cursor() QApplication::sendEvent(view.viewport(), &event); } - QCOMPARE(view.viewport()->cursor().shape(), item1->cursor().shape()); + QTRY_COMPARE(view.viewport()->cursor().shape(), item1->cursor().shape()); { QTest::mouseMove(view.viewport(), view.mapFromScene(item2->sceneBoundingRect().center())); @@ -4244,9 +4258,7 @@ void tst_QGraphicsItem::cursor() QApplication::sendEvent(view.viewport(), &event); } - QTest::qWait(25); - - QCOMPARE(view.viewport()->cursor().shape(), item2->cursor().shape()); + QTRY_COMPARE(view.viewport()->cursor().shape(), item2->cursor().shape()); { QTest::mouseMove(view.viewport(), view.rect().center()); @@ -4254,9 +4266,7 @@ void tst_QGraphicsItem::cursor() QApplication::sendEvent(view.viewport(), &event); } - QTest::qWait(25); - - QCOMPARE(view.viewport()->cursor().shape(), cursor.shape()); + QTRY_COMPARE(view.viewport()->cursor().shape(), viewportShape); } #endif /* -- cgit v1.2.3 From 9f4881297d961646bf3d02593045b8a1ce7670e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tony=20Saraj=C3=A4rvi?= Date: Thu, 22 May 2014 09:33:37 +0300 Subject: Mark tst_qfiledialog2 as insignificant due to failing tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-39183 Change-Id: I6663d0e4c49e904ffe5d5fdc990073abd4188d9d Reviewed-by: Simo Fält --- tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro index db36eea11d..5239614fc7 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro +++ b/tests/auto/widgets/dialogs/qfiledialog2/qfiledialog2.pro @@ -19,3 +19,5 @@ wince* { } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } + +macx:CONFIG += insignificant_test # QTBUG-39183 -- cgit v1.2.3 From 9a2dbcab7e820c63aac55ba08dc120a56986efac Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 13 May 2014 14:08:05 +0200 Subject: QPrinter/Windows: Fix handling of native paper source ids. On Windows, it is possible to pass native Windows paper source ids >= DMBIN_USER to QPrinter::setPaperSource() and they are listed by supportedPaperSources(). Task-number: QTBUG-38897 Task-number: QTBUG-38888 Change-Id: I8f1264e80ce5bdddd3873602200b24eabee00502 Reviewed-by: Lars Knoll Reviewed-by: Andy Shaw --- tests/manual/dialogs/printdialogpanel.cpp | 11 ++++++++++- tests/manual/dialogs/printdialogpanel.ui | 18 ++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp index 1a18f94406..e316486fcf 100644 --- a/tests/manual/dialogs/printdialogpanel.cpp +++ b/tests/manual/dialogs/printdialogpanel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -474,6 +474,15 @@ void PrintDialogPanel::retrieveSettings(const QPrinter *printer) setComboBoxValue(m_panel.m_colorModeCombo, printer->colorMode()); m_panel.m_resolution->setValue(printer->resolution()); +#ifdef Q_OS_WIN + QString availPaperSources; + foreach (QPrinter::PaperSource ps, printer->supportedPaperSources()) + availPaperSources += QString::number(int(ps)) + QLatin1Char(' '); + m_panel.availPaperSourceLabel->setText(availPaperSources); +#else + m_panel.availPaperSourceLabel->setText(QLatin1String("N/A")); +#endif + #if QT_VERSION >= 0x050300 m_pageLayout = printer->pageLayout(); #else diff --git a/tests/manual/dialogs/printdialogpanel.ui b/tests/manual/dialogs/printdialogpanel.ui index 2f0fe606a3..f4bab6fd9a 100644 --- a/tests/manual/dialogs/printdialogpanel.ui +++ b/tests/manual/dialogs/printdialogpanel.ui @@ -527,24 +527,24 @@ - + Color Mode: - + - + Resolution: - + @@ -584,6 +584,16 @@ + + + + Available Paper Sources: + + + + + + -- cgit v1.2.3 From 5d48eb8bbc43b37235c29c2caf1e5fafec864b49 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 19 May 2014 19:58:35 +0200 Subject: Cocoa: Make sure modal windows get correct geometry on show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit beginModalSessionForWindow will center the window and ignore the set geometry. So to workaround this it checks the new value against the old one and moves it back if need be. Change-Id: I38bc74c04138992f2e0570fca666414025aeeba8 Reviewed-by: Morten Johan Sørvig --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 589f3e66e1..868288e36e 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -92,6 +92,7 @@ private slots: void modalDialogClosingOneOfTwoModal(); void modalWithChildWindow(); void modalWindowModallity(); + void modalWindowPosition(); void initTestCase() { @@ -1429,6 +1430,18 @@ void tst_QWindow::modalWindowModallity() } +void tst_QWindow::modalWindowPosition() +{ + QWindow window; + window.setGeometry(QRect(100, 100, 400, 400)); + // Allow for any potential resizing due to constraints + QRect origGeo = window.geometry(); + window.setModality(Qt::WindowModal); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QCOMPARE(window.geometry(), origGeo); +} + #include QTEST_MAIN(tst_QWindow) -- cgit v1.2.3 From 787c0d76a2d7dbc6d7493915f4f765ac19a14062 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 23 May 2014 12:14:02 +0200 Subject: Replace hard-coded qWait() by QTRY_COMPARE/VERIFY in widget tests. Task-number: QTBUG-38890 Change-Id: I9a729430fcd30b782c100bb76d5e287a3b4c1238 Reviewed-by: Robin Burchell --- tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | 14 ++++---------- tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp | 8 +++----- 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index d02b86bd8a..7e0b0dac0c 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1726,9 +1726,8 @@ void tst_QMainWindow::addToolbarAfterShow() QToolBar toolBar; mainWindow.addToolBar(&toolBar); - QTest::qWait(100); - QVERIFY(!toolBar.isHidden()); + QTRY_VERIFY(!toolBar.isHidden()); } void tst_QMainWindow::centralWidgetSize() @@ -1743,8 +1742,7 @@ void tst_QMainWindow::centralWidgetSize() mainWindow.setCentralWidget(&widget); mainWindow.show(); - QTest::qWait(100); - QCOMPARE(widget.size(), widget.sizeHint()); + QTRY_COMPARE(widget.size(), widget.sizeHint()); } void tst_QMainWindow::dockWidgetSize() @@ -1789,19 +1787,15 @@ void tst_QMainWindow::QTBUG2774_stylechange() { - QTest::qWait(1000); mw.setStyleSheet("QMainWindow::separator { width: 50px; height:50px; }"); - QTest::qWait(5000); - QApplication::processEvents(); - QVERIFY(central->width() < centralOriginalWidth); + QTRY_VERIFY(central->width() < centralOriginalWidth); QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 49))); } { mw.setStyleSheet("QMainWindow::separator { width: 0px; height: 0px; }"); - QApplication::processEvents(); - QVERIFY(central->width() > centralOriginalWidth); + QTRY_VERIFY(central->width() > centralOriginalWidth); QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 1))); } diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp index a301d51c4c..8dd191e621 100644 --- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp @@ -127,9 +127,7 @@ void tst_QStatusBar::tempMessage() QCOMPARE(testWidget->currentMessage(), QString("Ready")); QCOMPARE(testWidget->currentMessage(), currentMessage); - QTest::qWait(1000); - - QVERIFY(testWidget->currentMessage().isNull()); + QTRY_VERIFY(testWidget->currentMessage().isNull()); QVERIFY(currentMessage.isNull()); testWidget->showMessage("Ready again", 500); @@ -294,10 +292,10 @@ void tst_QStatusBar::QTBUG25492_msgtimeout() QCOMPARE(testWidget->currentMessage(), QString("Ready")); QCOMPARE(testWidget->currentMessage(), currentMessage); - QTest::qWait(3000); + QTest::qWait(1500); // Message disappears after 2 seconds - QVERIFY(testWidget->currentMessage().isNull()); + QTRY_VERIFY(testWidget->currentMessage().isNull()); QVERIFY(currentMessage.isNull()); // Set display message for 2 seconds first -- cgit v1.2.3 From 3478ec29494c315c4e41f25a1265da928503694b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 27 May 2014 14:53:08 +0200 Subject: Move native subwidgets in QWidget::scroll(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-38999 Change-Id: Ie22dcf61895bbfc575eaae4d1929516a8749de39 Reviewed-by: Jørgen Lind --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 26 ++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 2a70431223..34936fa5b8 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -288,6 +288,7 @@ private slots: #ifndef Q_OS_MAC void scroll(); + void scrollNativeChildren(); #endif // tests QWidget::setGeometry() @@ -4336,7 +4337,30 @@ void tst_QWidget::scroll() QTRY_COMPARE(updateWidget.paintedRegion, dirty); } } -#endif + +// QTBUG-38999, scrolling a widget with native child widgets should move the children. +void tst_QWidget::scrollNativeChildren() +{ + QWidget parent; + parent.setWindowTitle(QLatin1String(__FUNCTION__)); + parent.resize(400, 400); + centerOnScreen(&parent); + QLabel *nativeLabel = new QLabel(QStringLiteral("nativeLabel"), &parent); + const QPoint oldLabelPos(100, 100); + nativeLabel->move(oldLabelPos); + QVERIFY(nativeLabel->winId()); + parent.show(); + QVERIFY(QTest::qWaitForWindowExposed(&parent)); + const QPoint delta(50, 50); + parent.scroll(delta.x(), delta.y()); + const QPoint newLabelPos = oldLabelPos + delta; + QWindow *labelWindow = nativeLabel->windowHandle(); + QVERIFY(labelWindow); + QTRY_COMPARE(labelWindow->geometry().topLeft(), newLabelPos); + QTRY_COMPARE(nativeLabel->geometry().topLeft(), newLabelPos); +} + +#endif // Mac OS class DestroyedSlotChecker : public QObject { -- cgit v1.2.3 From 909b0de5d16f2af3b3d6a3ca4c7e53b84836ad37 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 15 May 2014 13:32:27 +0200 Subject: Windows: Fix another crash when creating QRawFont from invalid data The sanity check added in d16508a285a5423ae9a5034e969801bce74ffb98 didn't actually catch the case where the invalid data is large enough to contain the offset table and table directory. Added sanity checks to all the code that accesses the font data now, so this should fix crashes with partial data as well as invalid data. Task-number: QTBUG-37190 Change-Id: Ie43f10d8cf0b09007783b9b1c4d91bfed8c6b0f0 Reviewed-by: Konstantin Ritt --- tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index 20bfaf99dd..a39277b093 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -948,6 +948,11 @@ void tst_QRawFont::rawFontFromInvalidData() font.loadFromData(invalidData, 10, QFont::PreferDefaultHinting); QVERIFY(!font.isValid()); + + invalidData.fill(255, 1024); + font.loadFromData(invalidData, 10, QFont::PreferDefaultHinting); + + QVERIFY(!font.isValid()); } #endif // QT_NO_RAWFONT -- cgit v1.2.3 From 267ba8b63e0fbf02cde4d2709397ed0e12f34ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Mon, 24 Mar 2014 19:17:43 +0100 Subject: QAbstractProxyModel::sibling: treat row/column as offsets within the proxy Qt5 allows QAIM subclasses to reimplement the sibling() method. Unfortunately, the default QAbstractProxyModel's reimplementation differs in behavior to what the Qt4 version was doing. In particular, the Qt4 version used to use the row and column as positions within the proxy model, while the Qt5 version mistakenly does this at the level of source model. This is arguably broken; the caller asks for a sibling of the proxy index, not for a sibling within the proxy model. This change makes the QAPM::sibling work explicitly in the same way as the Qt4 code behaved. The reimplementation of QAbstractProxyModel::sibling was introduced in 9dfba89c28bbff3316cb7aed6c07f90c0f2d5a22. It was subsequently fixed with commit 999109866dbd350a29cc70815d0c772545c85746 not to return indexes from the source model, but the logic was still different from the Qt4 version. [ChangeLog][QtCore][QAbstractProxyModel] Fixed QAbstractProxyModel::sibling to work in the same manner as the Qt4 code used to behave. Previously, Qt5's implementation would treat the row and column as positions in the source model instead of a position in the proxy itself. Followup-to 9dfba89c28bbff3316cb7aed6c07f90c0f2d5a22 and 999109866dbd350a29cc70815d0c772545c85746 Change-Id: Ia25027b2ad9e4777ba28de2d2226d48f8cccf587 Reviewed-by: Olivier Goffart Reviewed-by: Mark Brand Reviewed-by: Stephen Kelly --- .../tst_qabstractproxymodel.cpp | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp index c385a02b9c..f36bbbc5b6 100644 --- a/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractproxymodel/tst_qabstractproxymodel.cpp @@ -71,6 +71,7 @@ private slots: void submit_data(); void submit(); void testRoleNames(); + void testSwappingRowsProxy(); }; // Subclass that exposes the protected functions. @@ -397,6 +398,103 @@ void tst_QAbstractProxyModel::testRoleNames() QVERIFY( proxy2RoleNames.value(StandardItemModelWithCustomRoleNames::CustomRole2) == "custom2" ); } +// This class only supports very simple table models +class SwappingProxy : public QAbstractProxyModel +{ + static int swapRow(const int row) + { + if (row == 2) { + return 3; + } else if (row == 3) { + return 2; + } else { + return row; + } + } +public: + virtual QModelIndex index(int row, int column, const QModelIndex &parentIdx) const + { + if (!sourceModel()) + return QModelIndex(); + if (row < 0 || column < 0) + return QModelIndex(); + if (row >= sourceModel()->rowCount()) + return QModelIndex(); + if (column >= sourceModel()->columnCount()) + return QModelIndex(); + return createIndex(row, column, parentIdx.internalPointer()); + } + + virtual QModelIndex parent(const QModelIndex &parentIdx) const + { + // well, we're a 2D model + Q_UNUSED(parentIdx); + return QModelIndex(); + } + + virtual int rowCount(const QModelIndex &parentIdx) const + { + if (parentIdx.isValid() || !sourceModel()) + return 0; + return sourceModel()->rowCount(); + } + + virtual int columnCount(const QModelIndex &parentIdx) const + { + if (parentIdx.isValid() || !sourceModel()) + return 0; + return sourceModel()->rowCount(); + } + + virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const + { + if (!proxyIndex.isValid()) + return QModelIndex(); + if (!sourceModel()) + return QModelIndex(); + Q_ASSERT(!proxyIndex.parent().isValid()); + return sourceModel()->index(swapRow(proxyIndex.row()), proxyIndex.column(), QModelIndex()); + } + + virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const + { + if (!sourceIndex.isValid()) + return QModelIndex(); + if (!sourceModel()) + return QModelIndex(); + Q_ASSERT(!sourceIndex.parent().isValid()); + return index(swapRow(sourceIndex.row()), sourceIndex.column(), QModelIndex()); + } +}; + +void tst_QAbstractProxyModel::testSwappingRowsProxy() +{ + QStandardItemModel defaultModel; + defaultModel.setRowCount(4); + defaultModel.setColumnCount(2); + for (int row = 0; row < defaultModel.rowCount(); ++row) { + defaultModel.setItem(row, 0, new QStandardItem(QString::number(row) + QLatin1Char('A'))); + defaultModel.setItem(row, 1, new QStandardItem(QString::number(row) + QLatin1Char('B'))); + } + SwappingProxy proxy; + proxy.setSourceModel(&defaultModel); + QCOMPARE(proxy.data(proxy.index(0, 0, QModelIndex())), QVariant("0A")); + QCOMPARE(proxy.data(proxy.index(0, 1, QModelIndex())), QVariant("0B")); + QCOMPARE(proxy.data(proxy.index(1, 0, QModelIndex())), QVariant("1A")); + QCOMPARE(proxy.data(proxy.index(1, 1, QModelIndex())), QVariant("1B")); + QCOMPARE(proxy.data(proxy.index(2, 0, QModelIndex())), QVariant("3A")); + QCOMPARE(proxy.data(proxy.index(2, 1, QModelIndex())), QVariant("3B")); + QCOMPARE(proxy.data(proxy.index(3, 0, QModelIndex())), QVariant("2A")); + QCOMPARE(proxy.data(proxy.index(3, 1, QModelIndex())), QVariant("2B")); + + for (int row = 0; row < defaultModel.rowCount(); ++row) { + QModelIndex left = proxy.index(row, 0, QModelIndex()); + QModelIndex right = proxy.index(row, 1, QModelIndex()); + QCOMPARE(left.sibling(left.row(), 1), right); + QCOMPARE(right.sibling(right.row(), 0), left); + } +} + QTEST_MAIN(tst_QAbstractProxyModel) #include "tst_qabstractproxymodel.moc" -- cgit v1.2.3 From ce6c0d2e61f70d6175b763348e0860133dd4f54f Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Tue, 6 May 2014 11:23:09 +0200 Subject: QNX: Fix tst_qfilesystemwatcher If QNX does not have inotify there is no native engine. Change-Id: I042efd0b59f916f9e0b55bbe5c7f3fe7bb6914c8 Reviewed-by: Friedemann Kleint Reviewed-by: Sergio Ahumada Reviewed-by: Fabian Bumberger --- tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 4f7ddce9c3..e06af5a799 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -112,9 +112,11 @@ void tst_QFileSystemWatcher::basicTest_data() + QChar(ushort(0x00DC)) // LATIN_CAPITAL_LETTER_U_WITH_DIAERESIS + QStringLiteral(".txt"); +#if !defined(Q_OS_QNX) || !defined(QT_NO_INOTIFY) QTest::newRow("native backend-testfile") << "native" << testFile; - QTest::newRow("poller backend-testfile") << "poller" << testFile; QTest::newRow("native backend-specialchars") << "native" << specialCharacterFile; +#endif + QTest::newRow("poller backend-testfile") << "poller" << testFile; } void tst_QFileSystemWatcher::basicTest() -- cgit v1.2.3 From a149d2f73ec45084c589ef4211974ba50c0d4631 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Jun 2014 13:42:00 +0200 Subject: Do not clear default button in QMessageBox::setDetailedText(). Store the value of QMessageBoxPrivate::autoAddOkButton temporarily when automatically adding the "Show Details..." button. Task-number: QTBUG-39334 Change-Id: I173c83893548ee83b3d8ea2743f87686c32657e7 Reviewed-by: Shawn Rutledge --- tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 0425db3098..f9abd50a15 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -593,6 +593,11 @@ void tst_QMessageBox::detailsText() QString text("This is the details text."); box.setDetailedText(text); QCOMPARE(box.detailedText(), text); + box.show(); + QTest::qWaitForWindowExposed(&box); + // QTBUG-39334, the box should now have the default "Ok" button as well as + // the "Show Details.." button. + QCOMPARE(box.findChildren().size(), 2); } void tst_QMessageBox::detailsButtonText() -- cgit v1.2.3 From 7df8b1ada4b23acedda5724b492c26a8e322648b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 4 Jun 2014 13:52:37 +0200 Subject: Properly escape bytearray data outside the ascii range when using a codec Some codecs can't handle the range outside ascii properly and would then fail to read the data back in correctly. Task-number: QTBUG-15543 Change-Id: I4c02921e787a939eeec0c7a11603b5896d756aef Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 501ad6f415..2c9868cd10 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -166,6 +166,7 @@ private slots: void testByteArray_data(); void testByteArray(); + void iniCodec(); private: const bool m_canWriteNativeSystemSettings; @@ -695,6 +696,28 @@ void tst_QSettings::testByteArray() } } +void tst_QSettings::iniCodec() +{ + { + QSettings settings("QtProject", "tst_qsettings"); + settings.setIniCodec("cp1251"); + QByteArray ba; + ba.resize(256); + for (int i = 0; i < ba.size(); i++) + ba[i] = i; + settings.setValue("array",ba); + } + { + QSettings settings("QtProject", "tst_qsettings"); + settings.setIniCodec("cp1251"); + QByteArray ba = settings.value("array").toByteArray(); + QCOMPARE(ba.size(), 256); + for (int i = 0; i < ba.size(); i++) + QCOMPARE((uchar)ba.at(i), (uchar)i); + } + +} + void tst_QSettings::testErrorHandling_data() { QTest::addColumn("filePerms"); // -1 means file should not exist -- cgit v1.2.3