From 59780d132aa114f8b7edfb17a24b91d09e38236d Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Mon, 23 Jan 2017 15:25:38 -0800 Subject: Cocoa: fix crash regression in qt_mac_create_nsimage() The regression was introduced in d8857f21ac264. The original change was meant to fix support for SVG icons, but failed to take into account a valid QIcon with no sizes, but which is also unable to create a pixmap for the requested size. Task-number: QTBUG-58344 Change-Id: I7ac1dbfaf6e3dab8581fe4b33c814e2517fcdba8 Reviewed-by: Andy Shaw --- tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index f19d7619cc..e3af0135e7 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -136,6 +136,7 @@ private slots: void QTBUG_57404_existingMenuItemException(); #endif void taskQTBUG55966_subMenuRemoved(); + void QTBUG_58344_invalidIcon(); void platformMenu(); @@ -1594,5 +1595,14 @@ void tst_QMenuBar::taskQTBUG55966_subMenuRemoved() QTest::qWait(500); } +void tst_QMenuBar::QTBUG_58344_invalidIcon() +{ + QMenuBar menuBar; + QMenu menu("menu"); + menu.addAction(QIcon("crash.png"), "crash"); + menuBar.addMenu(&menu); + // No crash, all fine. +} + QTEST_MAIN(tst_QMenuBar) #include "tst_qmenubar.moc" -- cgit v1.2.3 From a8a74fe81acab07bfe068bff398555804629a88c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Jan 2017 11:21:32 +0100 Subject: Stabilize tst_QPropertyAnimation::noStartValue() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the qWait() and introduce a QTRY_COMPARE() checking for the end value first. Task-number: QTBUG-58402 Change-Id: I2d3758178de5f67881008f28c406076ad27c4a90 Reviewed-by: Jędrzej Nowacki --- .../corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index c1a8fde504..b0b0a307e9 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -441,10 +441,8 @@ void tst_QPropertyAnimation::noStartValue() a.setDuration(250); a.start(); - QTest::qWait(300); - - QTRY_COMPARE(o.values.first(), 42); - QCOMPARE(o.values.last(), 420); + QTRY_COMPARE(o.values.value(o.values.size() - 1, -1), 420); + QCOMPARE(o.values.first(), 42); } void tst_QPropertyAnimation::noStartValueWithLoop() -- cgit v1.2.3 From 374a173d1417a9f8c313088420cb1b792fe45977 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Jan 2017 15:14:45 +0100 Subject: Improve QTest::qWait() precision and switch to QDeadlineTimer Do not wait up to the timeout ms after already having waited several times. At the same time upgrade to using the QDeadlineTimer which is designed for this purpose. Change-Id: Iaf5e4f4655605d5143ce91040c6eb6706752e504 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp index 383f357206..b68c582732 100644 --- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp @@ -189,7 +189,7 @@ void tst_QTimeLine::frameRate() void tst_QTimeLine::value() { - QTimeLine timeLine(5000); + QTimeLine timeLine(4500); // Should be at least 5% under 5000ms QCOMPARE(timeLine.currentValue(), 0.0); // Default speed -- cgit v1.2.3 From f823af43f243b1848fd4a838847317d0ff6d4fdf Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 10 Nov 2016 14:57:04 +0100 Subject: QVariant of nullptr should always be null Implements isNull for QVariants of a nullptr so they always return true to isNull(), instead of depending on how they were constructed. Task-number: QTBUG-58296 Change-Id: Ibddec795cdadedef7e17d22c265c29e752d8f99f Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 11 +++++++++++ 1 file changed, 11 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 75fa424ab1..3a51e67768 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -400,6 +400,17 @@ void tst_QVariant::isNull() QVERIFY( !varLL.isNull() ); QVariant var7(QString::null); QVERIFY(var7.isNull()); + var7 = QVariant::fromValue(QString::null); + QVERIFY(var7.isNull()); + + QVariant var8(QMetaType::Nullptr, nullptr); + QVERIFY(var8.isNull()); + var8 = QVariant::fromValue(nullptr); + QVERIFY(var8.isNull()); + QVariant var9 = QVariant(QJsonValue(QJsonValue::Null)); + QVERIFY(var9.isNull()); + var9 = QVariant::fromValue(QJsonValue(QJsonValue::Null)); + QVERIFY(var9.isNull()); } void tst_QVariant::swap() -- cgit v1.2.3 From 1f814caca3836c43a415c219ef57b1d046321635 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 10:39:50 +0100 Subject: Plug memleaks in tst_QAbstractItemView Styles need to be deleted manually... Change-Id: Ic4193d22a57801127e994062cade7cb9ef6f34d8 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (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 bd6733e2d0..426db265ae 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1567,7 +1567,7 @@ void tst_QAbstractItemView::testChangeEditorState() QTableView view; view.setEditTriggers(QAbstractItemView::CurrentChanged); - view.setItemDelegate(new StateChangeDelegate); + view.setItemDelegate(new StateChangeDelegate(&view)); view.setModel(&model); centerOnScreen(&view); moveCursorAway(&view); @@ -1941,7 +1941,8 @@ void tst_QAbstractItemView::QTBUG50102_SH_ItemView_ScrollMode() QCOMPARE(view.horizontalScrollMode(), styleScrollMode); // Change style, get new value - view.setStyle(new ScrollModeProxyStyle(styleScrollMode)); + ScrollModeProxyStyle proxyStyle1(styleScrollMode); + view.setStyle(&proxyStyle1); auto proxyScrollMode = static_cast(view.style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, &view, 0)); QVERIFY(styleScrollMode != proxyScrollMode); QCOMPARE(view.verticalScrollMode(), proxyScrollMode); @@ -1953,7 +1954,8 @@ void tst_QAbstractItemView::QTBUG50102_SH_ItemView_ScrollMode() QCOMPARE(view.horizontalScrollMode(), proxyScrollMode); // Change style, won't change value for vertical, will change for horizontal - view.setStyle(new ScrollModeProxyStyle(proxyScrollMode)); + ScrollModeProxyStyle proxyStyle2(proxyScrollMode); + view.setStyle(&proxyStyle2); QCOMPARE(view.verticalScrollMode(), proxyScrollMode); QCOMPARE(view.horizontalScrollMode(), styleScrollMode); } -- cgit v1.2.3 From 9064d0b8a8da8ddb2223c405e5a1359288d49714 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 11:34:57 +0100 Subject: tst_QTreeWidget: plug memleaks Taken QTreeWidgetItems need to be deleted, as do items created without a parent, and widgets without parent. Change-Id: I7ffa69903af9a1b92ba308f9f9416aec1d6d975f Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 41 ++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index fcffaa0eb9..f20805f97e 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -554,16 +554,16 @@ void tst_QTreeWidget::removeChild() QFETCH(int, childCount); QFETCH(int, removeAt); - QTreeWidgetItem *root = new QTreeWidgetItem; + const QScopedPointer root(new QTreeWidgetItem); for (int i = 0; i < childCount; ++i) - new QTreeWidgetItem(root, QStringList(QString::number(i))); + new QTreeWidgetItem(root.data(), QStringList(QString::number(i))); QCOMPARE(root->childCount(), childCount); for (int j = 0; j < childCount; ++j) QCOMPARE(root->child(j)->text(0), QString::number(j)); - QTreeWidgetItem *remove = root->child(removeAt); - root->removeChild(remove); + const QScopedPointer remove(root->child(removeAt)); + root->removeChild(remove.data()); QCOMPARE(root->childCount(), childCount - 1); for (int k = 0; k < childCount; ++k) { @@ -574,7 +574,6 @@ void tst_QTreeWidget::removeChild() else if (k > removeAt) QCOMPARE(root->child(k - 1)->text(0), QString::number(k)); } - delete root; } void tst_QTreeWidget::setItemHidden() @@ -1954,9 +1953,9 @@ void tst_QTreeWidget::itemData() void tst_QTreeWidget::enableDisable() { - QTreeWidgetItem *itm = new QTreeWidgetItem(); + const QScopedPointer itm(new QTreeWidgetItem); for (int i = 0; i < 10; ++i) - new QTreeWidgetItem(itm); + new QTreeWidgetItem(itm.data()); // make sure all items are enabled QVERIFY(itm->flags() & Qt::ItemIsEnabled); @@ -2720,7 +2719,10 @@ void tst_QTreeWidget::setDisabled() children.append(new QTreeWidgetItem()); children.append(new QTreeWidgetItem()); children.append(new QTreeWidgetItem()); - i1 = top->takeChild(0); + { + const QScopedPointer taken(top->takeChild(0)); + QCOMPARE(taken.data(), i1); + } top->addChildren(children); QCOMPARE(top->child(0)->isDisabled(), false); @@ -2732,16 +2734,21 @@ void tst_QTreeWidget::setDisabled() QCOMPARE(top->child(1)->isDisabled(), true); QCOMPARE(top->child(1)->isDisabled(), true); - children = top->takeChildren(); - QCOMPARE(children.at(0)->isDisabled(), false); - QCOMPARE(children.at(1)->isDisabled(), false); - QCOMPARE(children.at(1)->isDisabled(), false); + struct Deleter { + QList items; + explicit Deleter(QList items) : items(std::move(items)) {} + ~Deleter() { qDeleteAll(items); } + }; + const Deleter takenChildren(top->takeChildren()); + QCOMPARE(takenChildren.items[0]->isDisabled(), false); + QCOMPARE(takenChildren.items[1]->isDisabled(), false); + QCOMPARE(takenChildren.items[1]->isDisabled(), false); } void tst_QTreeWidget::removeSelectedItem() { - QTreeWidget *w = new QTreeWidget(); + const QScopedPointer w(new QTreeWidget); w->setSortingEnabled(true); QTreeWidgetItem *first = new QTreeWidgetItem(); @@ -2767,15 +2774,13 @@ void tst_QTreeWidget::removeSelectedItem() QCOMPARE(selModel->hasSelection(), true); QCOMPARE(selModel->selectedRows().count(), 1); - QTreeWidgetItem *taken = w->takeTopLevelItem(2); + const QScopedPointer taken(w->takeTopLevelItem(2)); QCOMPARE(taken->text(0), QLatin1String("C")); QCOMPARE(selModel->hasSelection(), false); QCOMPARE(selModel->selectedRows().count(), 0); QItemSelection sel = selModel->selection(); QCOMPARE(selModel->isSelected(w->model()->index(0,0)), false); - - delete w; } class AnotherTreeWidget : public QTreeWidget @@ -2934,11 +2939,11 @@ void tst_QTreeWidget::sortAndSelect() void tst_QTreeWidget::defaultRowSizes() { - QTreeWidget *tw = new QTreeWidget(); + const QScopedPointer tw(new QTreeWidget); tw->setIconSize(QSize(50, 50)); tw->setColumnCount(6); for (int i=0; i<10; ++i) { - QTreeWidgetItem *it = new QTreeWidgetItem(tw); + auto it = new QTreeWidgetItem(tw.data()); for (int j=0; jcolumnCount() - 1; ++j) { it->setText(j, "This is a test"); } -- cgit v1.2.3 From 7e6e92063324e589aa01928efae72b16f2823481 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 11:45:25 +0100 Subject: Plug memleaks in tst_QTreeView Forgot to delete QAIMs without parent. Change-Id: I9c914e841123ee250fb977c45a84870463288d9b Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 80ef0879cc..e2886cfcfe 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -3796,25 +3796,24 @@ void tst_QTreeView::task248022_changeSelection() void tst_QTreeView::task245654_changeModelAndExpandAll() { QTreeView view; - QStandardItemModel *model = new QStandardItemModel; + QScopedPointer model(new QStandardItemModel); QStandardItem *top = new QStandardItem("top"); QStandardItem *sub = new QStandardItem("sub"); top->appendRow(sub); model->appendRow(top); - view.setModel(model); + view.setModel(model.data()); view.expandAll(); QApplication::processEvents(); QVERIFY(view.isExpanded(top->index())); //now let's try to delete the model //then repopulate and expand again - delete model; - model = new QStandardItemModel; + model.reset(new QStandardItemModel); top = new QStandardItem("top"); sub = new QStandardItem("sub"); top->appendRow(sub); model->appendRow(top); - view.setModel(model); + view.setModel(model.data()); view.expandAll(); QApplication::processEvents(); QVERIFY(view.isExpanded(top->index())); -- cgit v1.2.3 From e4b19bfb94630c7da37d150955ccc246498966cf Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 15:04:34 +0100 Subject: Plug memleaks in tst_QHeaderView The char* returned from QTest::toString() calls must be manually delete[]ed. Change-Id: Iad078e8741e3e97693b1a417693f414b3fb3ec09 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 1078dcc2e9..7bfec2831d 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -2523,7 +2523,8 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare const bool sanity_checks = true; if (sanity_checks) { QString msg = QString("sanity problem at ") + sline; - char *verifytext = QTest::toString(msg); + const QScopedArrayPointer holder(QTest::toString(msg)); + const auto verifytext = holder.data(); QVERIFY2(m_tableview->model()->rowCount() == view->count() , verifytext); QVERIFY2(view->visualIndex(lastindex + 1) <= 0, verifytext); // there is no such index in model @@ -2555,7 +2556,8 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare msg += istr(chk_visual) + istr(chk_logical) + istr(chk_sizes) + istr(chk_hidden_size) + istr(chk_lookup_visual) + istr(chk_lookup_logical) + istr(header_lenght, false) + "};"; - char *verifytext = QTest::toString(msg); + const QScopedArrayPointer holder(QTest::toString(msg)); + const auto verifytext = holder.data(); QVERIFY2(chk_visual == x[0], verifytext); QVERIFY2(chk_logical == x[1], verifytext); -- cgit v1.2.3 From e15cb86b3bc2cb1ed777a741f4b9e23fdb829249 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Jan 2017 15:07:46 +0100 Subject: Plug remaining memleaks in tests/auto/widgets/itemviews ... on Linux AMD64 builds. Pass QObject parents to QObjects otherwise leaked. Change-Id: Ia4f0ad2fdc4ef62a3d35a2cfca74965f79692da3 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp | 2 +- tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp | 2 +- tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 0720a4f766..5b353bb2ae 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1350,7 +1350,7 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck() } QTableView view; view.setModel(&model); - view.setItemDelegate(new TestItemDelegate); + view.setItemDelegate(new TestItemDelegate(&view)); view.show(); view.selectAll(); QVERIFY(QTest::qWaitForWindowExposed(&view)); diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 6eed21abb2..a89f8f3c8a 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -1488,7 +1488,7 @@ void tst_QListView::task203585_selectAll() //we make sure that "select all" doesn't select the hidden items QListView view; view.setSelectionMode(QAbstractItemView::ExtendedSelection); - view.setModel(new QStringListModel( QStringList() << "foo")); + view.setModel(new QStringListModel(QStringList() << "foo", &view)); view.setRowHidden(0, true); view.selectAll(); QVERIFY(view.selectionModel()->selectedIndexes().isEmpty()); diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index eb93e4c167..6547bb8985 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -1629,7 +1629,7 @@ void tst_QListWidget::QTBUG14363_completerWithAnyKeyPressedEditTriggers() { QListWidget listWidget; listWidget.setEditTriggers(QAbstractItemView::AnyKeyPressed); - listWidget.setItemDelegate(new ItemDelegate); + listWidget.setItemDelegate(new ItemDelegate(&listWidget)); QListWidgetItem *item = new QListWidgetItem(QLatin1String("select an item (don't start editing)"), &listWidget); item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable); new QListWidgetItem(QLatin1String("try to type the letter 'c'"), &listWidget); -- cgit v1.2.3 From 940d667eb41958de120ee759323c67bd7385af0d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 4 Oct 2016 19:49:58 +0200 Subject: Plug leaks in tests/auto/dbus In tst_QDBusMetaObject::types(), hold a QMetaObject obtained from QDBusMetaObject::createMetaObject() in a QScopedPointer instead of leaking it. Use correct return value type. This fixes the remaining errors in GCC 6.1 Linux ASan runs of tests/auto/dbus. Change-Id: I1df7f8e42d45f40ecf381fe7b684a8ab5ebee675 Reviewed-by: Alex Blasche Reviewed-by: Thiago Macieira --- tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp b/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp index cb1c9401ba..a4afae4b46 100644 --- a/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp +++ b/tests/auto/dbus/qdbusmetaobject/tst_qdbusmetaobject.cpp @@ -370,8 +370,7 @@ void tst_QDBusMetaObject::types() QDBusError error; - QMetaObject *result = QDBusMetaObject::createMetaObject("local.Interface", xml, - map, error); + const QScopedPointer result(QDBusMetaObject::createMetaObject("local.Interface", xml, map, error)); QVERIFY2(result, qPrintable(error.message())); QCOMPARE(result->enumeratorCount(), 0); -- cgit v1.2.3 From 8d752b5151c9890b76d50c4a479ab32dd0eca10c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 26 Jan 2017 10:28:41 +0100 Subject: Accept all formatting characters as valid input Amends 7896ae052ad2c0c6ae2ebfc64cc2f525185198a8. The previous change focused only on ZWJ and ZWNJ, but there are many other formatting characters that we need to support and that may be rejected by the German keyboard-hack. This opens up for all characters in the Other_Format category. Task-number: QTBUG-58364 Change-Id: Idd967a9ae5b12060c851f6030b7e019508561696 Reviewed-by: Simon Hausmann Reviewed-by: Lars Knoll --- .../gui/text/qinputcontrol/tst_qinputcontrol.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp index ad5ba6affb..173e137d17 100644 --- a/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp +++ b/tests/auto/gui/text/qinputcontrol/tst_qinputcontrol.cpp @@ -59,6 +59,28 @@ void tst_QInputControl::isAcceptableInput_data() QTest::newRow("printable-hebrew") << QString(QChar(0x2135)) << Qt::KeyboardModifiers() << true; QTest::newRow("private-use-area") << QString(QChar(0xE832)) << Qt::KeyboardModifiers() << true; QTest::newRow("multiple-printable") << QStringLiteral("foobar") << Qt::KeyboardModifiers() << true; + QTest::newRow("rlm") << QString(QChar(0x200F)) << Qt::KeyboardModifiers() << true; + QTest::newRow("rlm-with-ctrl") << QString(QChar(0x200F)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("rlm-with-ctrl-shift") << QString(QChar(0x200F)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("lrm") << QString(QChar(0x200E)) << Qt::KeyboardModifiers() << true; + QTest::newRow("lrm-with-ctrl") << QString(QChar(0x200E)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("lrm-with-ctrl-shift") << QString(QChar(0x200E)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("rlo") << QString(QChar(0x202E)) << Qt::KeyboardModifiers() << true; + QTest::newRow("rlo-with-ctrl") << QString(QChar(0x202E)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("rlo-with-ctrl-shift") << QString(QChar(0x202E)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("lro") << QString(QChar(0x202D)) << Qt::KeyboardModifiers() << true; + QTest::newRow("lro-with-ctrl") << QString(QChar(0x202D)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("lro-with-ctrl-shift") << QString(QChar(0x202D)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("lre") << QString(QChar(0x202B)) << Qt::KeyboardModifiers() << true; + QTest::newRow("lre-with-ctrl") << QString(QChar(0x202B)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("lre-with-ctrl-shift") << QString(QChar(0x202B)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("rle") << QString(QChar(0x202A)) << Qt::KeyboardModifiers() << true; + QTest::newRow("rle-with-ctrl") << QString(QChar(0x202A)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("rle-with-ctrl-shift") << QString(QChar(0x202A)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + QTest::newRow("pdf") << QString(QChar(0x202C)) << Qt::KeyboardModifiers() << true; + QTest::newRow("pdf-with-ctrl") << QString(QChar(0x202C)) << Qt::KeyboardModifiers(Qt::ControlModifier) << true; + QTest::newRow("pdf-with-ctrl-shift") << QString(QChar(0x202C)) << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::ShiftModifier) << true; + } void tst_QInputControl::isAcceptableInput() -- cgit v1.2.3