summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/dialogs.pro1
-rw-r--r--tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro4
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp55
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp68
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp122
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp99
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp67
-rw-r--r--tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp7
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp15
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp7
-rw-r--r--tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp99
-rw-r--r--tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp27
-rw-r--r--tests/auto/widgets/kernel/kernel.pro1
-rw-r--r--tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp7
-rw-r--r--tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp17
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp6
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp12
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp17
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/.gitignore1
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro6
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp226
-rw-r--r--tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp4
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp11
-rw-r--r--tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp6
-rw-r--r--tests/auto/widgets/util/qscroller/tst_qscroller.cpp15
-rw-r--r--tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp2
-rw-r--r--tests/auto/widgets/util/qundostack/tst_qundostack.cpp92
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp13
-rw-r--r--tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp8
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp10
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp1
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp1
-rw-r--r--tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp36
-rw-r--r--tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp2
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp14
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp4
43 files changed, 922 insertions, 183 deletions
diff --git a/tests/auto/widgets/dialogs/dialogs.pro b/tests/auto/widgets/dialogs/dialogs.pro
index 034f37c6e0..e767c9767e 100644
--- a/tests/auto/widgets/dialogs/dialogs.pro
+++ b/tests/auto/widgets/dialogs/dialogs.pro
@@ -20,3 +20,4 @@ wince*:SUBDIRS -= qabstractprintdialog
qsidebar \
mac:qinputdialog.CONFIG += no_check_target # QTBUG-25496
+win32-g++*: SUBDIRS -= qfilesystemmodel # QTBUG-29403
diff --git a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp
index 9654f3ac5e..e091267889 100644
--- a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp
+++ b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp
@@ -61,7 +61,7 @@ void tst_QErrorMessage::dontShowAgain()
QErrorMessage errorMessageDialog(0);
- // show an error with plain string
+ // show an error with plain string
errorMessageDialog.showMessage(plainString);
QVERIFY(errorMessageDialog.isVisible());
checkBox = qFindChild<QCheckBox*>(&errorMessageDialog);
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
index 5606033240..78639e87a5 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
@@ -1,6 +1,6 @@
CONFIG += testcase
-CONFIG += parallel_test
-win32:testcase.timeout = 900 # this testcase can be slow on Windows
+# This testcase can be slow on Windows and may interfere with other file system tests.
+win32:testcase.timeout = 900
QT += widgets widgets-private
QT += core-private gui testlib
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index db80aa1b22..e36eaa5af2 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -48,6 +48,7 @@
#include <QFileIconProvider>
#include <QTreeView>
#include <QHeaderView>
+#include <QStandardPaths>
#include <QTime>
#include <QStyle>
#include <QtGlobal>
@@ -109,6 +110,7 @@ private slots:
void setData_data();
void setData();
+ void sortPersistentIndex();
void sort_data();
void sort();
@@ -207,27 +209,30 @@ void tst_QFileSystemModel::rootPath()
QCOMPARE(rootChanged.count(), 0);
QString oldRootPath = model->rootPath();
- root = model->setRootPath(QDir::homePath());
+ const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
+ QVERIFY(!documentPaths.isEmpty());
+ const QString documentPath = documentPaths.front();
+ root = model->setRootPath(documentPath);
QTRY_VERIFY(model->rowCount(root) >= 0);
- QCOMPARE(model->rootPath(), QString(QDir::homePath()));
+ QCOMPARE(model->rootPath(), QString(documentPath));
QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? 0 : 1);
- QCOMPARE(model->rootDirectory().absolutePath(), QDir::homePath());
+ QCOMPARE(model->rootDirectory().absolutePath(), documentPath);
model->setRootPath(QDir::rootPath());
int oldCount = rootChanged.count();
oldRootPath = model->rootPath();
- root = model->setRootPath(QDir::homePath() + QLatin1String("/."));
+ root = model->setRootPath(documentPath + QLatin1String("/."));
QTRY_VERIFY(model->rowCount(root) >= 0);
- QCOMPARE(model->rootPath(), QDir::homePath());
+ QCOMPARE(model->rootPath(), documentPath);
QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? oldCount : oldCount + 1);
- QCOMPARE(model->rootDirectory().absolutePath(), QDir::homePath());
+ QCOMPARE(model->rootDirectory().absolutePath(), documentPath);
- QDir newdir = QDir::home();
+ QDir newdir = documentPath;
if (newdir.cdUp()) {
oldCount = rootChanged.count();
oldRootPath = model->rootPath();
- root = model->setRootPath(QDir::homePath() + QLatin1String("/.."));
+ root = model->setRootPath(documentPath + QLatin1String("/.."));
QTRY_VERIFY(model->rowCount(root) >= 0);
QCOMPARE(model->rootPath(), newdir.path());
QCOMPARE(rootChanged.count(), oldCount + 1);
@@ -310,9 +315,9 @@ void tst_QFileSystemModel::naturalCompare()
void tst_QFileSystemModel::readOnly()
{
QCOMPARE(model->isReadOnly(), true);
- QTemporaryFile file;
+ QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
file.open();
- QModelIndex root = model->setRootPath(QDir::tempPath());
+ QModelIndex root = model->setRootPath(flatDirTestPath);
QTRY_VERIFY(model->rowCount(root) > 0);
QVERIFY(!(model->flags(model->index(file.fileName())) & Qt::ItemIsEditable));
@@ -358,7 +363,10 @@ void tst_QFileSystemModel::iconProvider()
delete p;
QFileSystemModel *myModel = new QFileSystemModel();
- myModel->setRootPath(QDir::homePath());
+ const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
+ QVERIFY(!documentPaths.isEmpty());
+ const QString documentPath = documentPaths.front();
+ myModel->setRootPath(documentPath);
//Let's wait to populate the model
QTest::qWait(250);
//We change the provider, icons must me updated
@@ -791,6 +799,19 @@ void tst_QFileSystemModel::setData()
QTRY_COMPARE(model->rowCount(root), files.count());
}
+void tst_QFileSystemModel::sortPersistentIndex()
+{
+ QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
+ file.open();
+ QModelIndex root = model->setRootPath(flatDirTestPath);
+ QTRY_VERIFY(model->rowCount(root) > 0);
+
+ QPersistentModelIndex idx = model->index(0, 1, root);
+ model->sort(0, Qt::AscendingOrder);
+ model->sort(0, Qt::DescendingOrder);
+ QVERIFY(idx.column() != 0);
+}
+
class MyFriendFileSystemModel : public QFileSystemModel
{
friend class tst_QFileSystemModel;
@@ -806,18 +827,6 @@ void tst_QFileSystemModel::sort_data()
void tst_QFileSystemModel::sort()
{
- QTemporaryFile file;
- file.open();
- QModelIndex root = model->setRootPath(QDir::tempPath());
- QTRY_VERIFY(model->rowCount(root) > 0);
-
- QPersistentModelIndex idx = model->index(0, 1, root);
- model->sort(0, Qt::AscendingOrder);
- model->sort(0, Qt::DescendingOrder);
- QVERIFY(idx.column() != 0);
-
- model->setRootPath(QDir::homePath());
-
QFETCH(bool, fileDialogMode);
MyFriendFileSystemModel *myModel = new MyFriendFileSystemModel();
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 3922cce5cc..ae5853f3c8 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -611,7 +611,7 @@ void tst_QWizard::addPage()
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), N + 52);
- QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page");
+ QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page");
wizard.addPage(0); // generates a warning
QCOMPARE(spy.count(), 0);
delete parent;
@@ -638,7 +638,7 @@ void tst_QWizard::setPage()
QCOMPARE(wizard.nextId(), -1);
page = new QWizardPage(parent);
- QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1");
+ QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1");
wizard.setPage(-1, page); // gives a warning and does nothing
QCOMPARE(spy.count(), 0);
QVERIFY(!wizard.page(-2));
@@ -2453,7 +2453,7 @@ private:
QLayout *layout_ = new QVBoxLayout(this);
layout_->addWidget(treeWidget = new QTreeWidget);
-
+
QSizePolicy policy = sizePolicy();
policy.setVerticalPolicy(verticalPolicy);
treeWidget->setSizePolicy(policy);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index fb55cf3d8f..41e5ed466c 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -1549,7 +1549,7 @@ void tst_QGraphicsGridLayout::setColumnSpacing()
}
void tst_QGraphicsGridLayout::setGeometry_data()
-{
+{
QTest::addColumn<QRectF>("rect");
QTest::newRow("null") << QRectF();
QTest::newRow("normal") << QRectF(0,0, 50, 50);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index b14e68951b..56cf27155d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -424,6 +424,7 @@ private slots:
void activate();
void setActivePanelOnInactiveScene();
void activationOnShowHide();
+ void deactivateInactivePanel();
void moveWhileDeleting();
void ensureDirtySceneTransform();
void focusScope();
@@ -2204,7 +2205,6 @@ void tst_QGraphicsItem::sceneMatrix()
void tst_QGraphicsItem::setMatrix()
{
QGraphicsScene scene;
- qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>)));
QRectF unrotatedRect(-12, -34, 56, 78);
QGraphicsRectItem item(unrotatedRect, 0);
@@ -9030,6 +9030,40 @@ public:
}
};
+void tst_QGraphicsItem::deactivateInactivePanel()
+{
+ QGraphicsScene scene;
+ QGraphicsItem *panel1 = scene.addRect(QRectF(0, 0, 10, 10));
+ panel1->setFlag(QGraphicsItem::ItemIsPanel);
+
+ QGraphicsItem *panel2 = scene.addRect(QRectF(0, 0, 10, 10));
+ panel2->setFlag(QGraphicsItem::ItemIsPanel);
+
+ QEvent event(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &event);
+
+ panel1->setActive(true);
+ QVERIFY(scene.isActive());
+ QVERIFY(panel1->isActive());
+ QVERIFY(!panel2->isActive());
+ QCOMPARE(scene.activePanel(), panel1);
+
+ panel2->setActive(true);
+ QVERIFY(panel2->isActive());
+ QVERIFY(!panel1->isActive());
+ QCOMPARE(scene.activePanel(), panel2);
+
+ panel2->setActive(false);
+ QVERIFY(panel1->isActive());
+ QVERIFY(!panel2->isActive());
+ QCOMPARE(scene.activePanel(), panel1);
+
+ panel2->setActive(false);
+ QVERIFY(panel1->isActive());
+ QVERIFY(!panel2->isActive());
+ QCOMPARE(scene.activePanel(), panel1);
+}
+
void tst_QGraphicsItem::moveWhileDeleting()
{
QGraphicsScene scene;
@@ -10333,23 +10367,24 @@ void tst_QGraphicsItem::modality_clickFocus()
EventSpy2 rect1Spy(&scene, rect1);
EventSpy2 rect2Spy(&scene, rect2);
- // activate rect1, it should not get focus
+ // activate rect1, it should get focus
rect1->setActive(true);
- QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0);
+ QCOMPARE(scene.focusItem(), (QGraphicsItem *) rect1);
- // focus stays unset when rect2 becomes modal
+ // focus stays when rect2 becomes modal
rect2->setPanelModality(QGraphicsItem::SceneModal);
- QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 0);
+ QCOMPARE(scene.focusItem(), (QGraphicsItem *) rect1);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 1);
QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 0);
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 0);
QCOMPARE(rect2Spy.counts[QEvent::FocusOut], 0);
// clicking on rect1 should not set it's focus item
+ rect1->clearFocus();
sendMouseClick(&scene, QPointF(-25, -25));
QCOMPARE(rect1->focusItem(), (QGraphicsItem *) 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 0);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 1);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 1);
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 0);
QCOMPARE(rect2Spy.counts[QEvent::FocusOut], 0);
@@ -10357,33 +10392,34 @@ void tst_QGraphicsItem::modality_clickFocus()
rect2->setActive(true);
sendMouseClick(&scene, QPointF(75, 75));
QCOMPARE(scene.focusItem(), (QGraphicsItem *) rect2);
- QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 0);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 1);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 1);
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1);
QCOMPARE(rect2Spy.counts[QEvent::FocusOut], 0);
// clicking on rect1 does *not* give it focus
rect1->setActive(true);
+ rect1->clearFocus();
sendMouseClick(&scene, QPointF(-25, -25));
QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 0);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 2);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 2);
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1);
QCOMPARE(rect2Spy.counts[QEvent::FocusOut], 1);
// focus doesn't change when leaving modality either
rect2->setPanelModality(QGraphicsItem::NonModal);
QCOMPARE(scene.focusItem(), (QGraphicsItem *) 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 0);
- QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 0);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 2);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 2);
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1);
QCOMPARE(rect2Spy.counts[QEvent::FocusOut], 1);
// click on rect1, it should get focus now
sendMouseClick(&scene, QPointF(-25, -25));
QCOMPARE(scene.focusItem(), (QGraphicsItem *) rect1);
- QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 1);
- QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 0);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusIn], 3);
+ QCOMPARE(rect1Spy.counts[QEvent::FocusOut], 2);
QCOMPARE(rect2Spy.counts[QEvent::FocusIn], 1);
QCOMPARE(rect2Spy.counts[QEvent::FocusOut], 1);
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 7a5f7319bc..fe1df6c8f0 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -240,7 +240,7 @@ private slots:
void update();
void update2();
void views();
- void event();
+ void testEvent();
void eventsToDisabledItems();
void exposedRect();
void tabFocus_emptyScene();
@@ -266,6 +266,7 @@ private slots:
void siblingIndexAlwaysValid();
void removeFullyTransparentItem();
void zeroScale();
+ void focusItemChangedSignal();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -2910,7 +2911,7 @@ protected:
}
};
-void tst_QGraphicsScene::event()
+void tst_QGraphicsScene::testEvent()
{
// Test that QGraphicsScene properly propagates events to QObject.
CustomScene scene;
@@ -3883,11 +3884,11 @@ void tst_QGraphicsScene::initialFocus_data()
QTest::addColumn<bool>("shouldHaveFocus");
QTest::newRow("inactive scene, normal item") << false << false << false << false;
- QTest::newRow("inactive scene, panel item") << false << false << true << false;
+ QTest::newRow("inactive scene, panel item") << false << false << true << true;
QTest::newRow("inactive scene, normal item, explicit focus") << false << true << false << true;
QTest::newRow("inactive scene, panel, explicit focus") << false << true << true << true;
QTest::newRow("active scene, normal item") << true << false << false << false;
- QTest::newRow("active scene, panel item") << true << false << true << false;
+ QTest::newRow("active scene, panel item") << true << false << true << true;
QTest::newRow("active scene, normal item, explicit focus") << true << true << false << true;
QTest::newRow("active scene, panel, explicit focus") << true << true << true << true;
}
@@ -4561,6 +4562,119 @@ void tst_QGraphicsScene::zeroScale()
QTRY_COMPARE(cl.changes.count(), 2);
}
+void tst_QGraphicsScene::focusItemChangedSignal()
+{
+ qRegisterMetaType<QGraphicsItem *>("QGraphicsItem *");
+ qRegisterMetaType<Qt::FocusReason>("Qt::FocusReason");
+
+ QGraphicsScene scene;
+ QSignalSpy spy(&scene, SIGNAL(focusItemChanged(QGraphicsItem *, QGraphicsItem *, Qt::FocusReason)));
+ QVERIFY(spy.isValid());
+ QCOMPARE(spy.count(), 0);
+ scene.setFocus();
+ QCOMPARE(spy.count(), 0);
+ QEvent activateEvent(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &activateEvent);
+ QCOMPARE(spy.count(), 0);
+
+ QGraphicsRectItem *topLevelItem1 = new QGraphicsRectItem;
+ topLevelItem1->setFlag(QGraphicsItem::ItemIsFocusable);
+ scene.addItem(topLevelItem1);
+ QCOMPARE(spy.count(), 0);
+ QVERIFY(!topLevelItem1->hasFocus());
+
+ QGraphicsRectItem *topLevelItem2 = new QGraphicsRectItem;
+ topLevelItem2->setFlag(QGraphicsItem::ItemIsFocusable);
+ topLevelItem2->setFocus();
+ QVERIFY(!topLevelItem2->hasFocus());
+ scene.addItem(topLevelItem2);
+ QCOMPARE(spy.count(), 1);
+ QList<QVariant> arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
+ QVERIFY(topLevelItem2->hasFocus());
+
+ scene.clearFocus();
+ QCOMPARE(spy.count(), 1);
+ arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason);
+
+ scene.setFocus(Qt::MenuBarFocusReason);
+ QCOMPARE(spy.count(), 1);
+ arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason);
+
+ for (int i = 0; i < 3; ++i) {
+ topLevelItem1->setFocus(Qt::TabFocusReason);
+ arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
+
+ topLevelItem2->setFocus(Qt::TabFocusReason);
+ arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason);
+ }
+
+ // The following two are unexpected, but fixing this (i.e., losing and gaining focus
+ // when the scene activation changes) breaks quite a few tests so leave this fix
+ // for some future release. See QTBUG-28346.
+ QEvent deactivateEvent(QEvent::WindowDeactivate);
+ qApp->sendEvent(&scene, &deactivateEvent);
+ QEXPECT_FAIL("", "QTBUG-28346", Continue);
+ QCOMPARE(spy.count(), 1);
+ qApp->sendEvent(&scene, &activateEvent);
+ QEXPECT_FAIL("", "QTBUG-28346", Continue);
+ QCOMPARE(spy.count(), 1);
+
+ QGraphicsRectItem *panel1 = new QGraphicsRectItem;
+ panel1->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable);
+ panel1->setFocus();
+ scene.addItem(panel1);
+ QCOMPARE(spy.count(), 1);
+ arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
+
+ QGraphicsRectItem *panel2 = new QGraphicsRectItem;
+ panel2->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable);
+ scene.addItem(panel2);
+ QCOMPARE(spy.count(), 0);
+
+ for (int i = 0; i < 3; ++i) {
+ scene.setActivePanel(panel2);
+ QCOMPARE(spy.count(), 1);
+ arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
+
+ scene.setActivePanel(panel1);
+ QCOMPARE(spy.count(), 1);
+ arguments = spy.takeFirst();
+ QCOMPARE(arguments.size(), 3);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1);
+ QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2);
+ QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason);
+ }
+
+}
+
void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache()
{
QGraphicsScene scene;
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 69665572f7..4cfdfccd63 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -172,12 +172,12 @@ private slots:
void initialShow2();
void itemChangeEvents();
void itemSendGeometryPosChangesDeactivated();
-
void fontPropagatesResolveToChildren();
void fontPropagatesResolveToGrandChildren();
void fontPropagatesResolveInParentChange();
void fontPropagatesResolveViaNonWidget();
void fontPropagatesResolveFromScene();
+ void tabFocus();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -3302,6 +3302,103 @@ void tst_QGraphicsWidget::itemSendGeometryPosChangesDeactivated()
QCOMPARE(item->geometry(), QRectF(10, 10, 60, 60));
}
+class TabFocusWidget : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ TabFocusWidget(const QString &name, QGraphicsItem *parent = 0)
+ : QGraphicsWidget(parent)
+ { setFocusPolicy(Qt::TabFocus); setData(0, name); }
+};
+
+void verifyTabFocus(QGraphicsScene *scene, const QList<QGraphicsWidget *> &chain, bool wrapsAround)
+{
+ QKeyEvent tabEvent(QEvent::KeyPress, Qt::Key_Tab, 0);
+ QKeyEvent backtabEvent(QEvent::KeyPress, Qt::Key_Backtab, 0);
+
+ for (int i = 0; i < chain.size(); ++i)
+ chain.at(i)->clearFocus();
+
+ int n = chain.size() * (wrapsAround ? 3 : 1);
+ for (int i = 0; i < n; ++i)
+ {
+ qApp->sendEvent(scene, &tabEvent);
+ QVERIFY(chain.at(i % chain.size())->hasFocus());
+ QCOMPARE(scene->focusItem(), chain.at(i % chain.size()));
+ }
+ for (int i = n - 2; i >= 0; --i)
+ {
+ qApp->sendEvent(scene, &backtabEvent);
+ QVERIFY(chain.at(i % chain.size())->hasFocus());
+ QCOMPARE(scene->focusItem(), chain.at(i % chain.size()));
+ }
+}
+
+void tst_QGraphicsWidget::tabFocus()
+{
+ QGraphicsScene scene;
+ scene.setFocus();
+
+ QEvent activate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &activate);
+
+ TabFocusWidget *widget = new TabFocusWidget("1");
+ scene.addItem(widget);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget, false);
+
+ TabFocusWidget *widget2 = new TabFocusWidget("2");
+ scene.addItem(widget2);
+ scene.setFocusItem(0);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget << widget2, false);
+
+ TabFocusWidget *widget3 = new TabFocusWidget("3");
+ widget3->setFlag(QGraphicsItem::ItemIsPanel);
+ scene.addItem(widget3);
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)widget3);
+ scene.setActivePanel(0);
+ scene.setFocusItem(0);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget << widget2, false);
+
+ scene.setActivePanel(widget3);
+ QCOMPARE(scene.focusItem(), (QGraphicsItem *)widget3);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3, true);
+
+ TabFocusWidget *widget4 = new TabFocusWidget("4");
+ widget4->setParentItem(widget3);
+ QVERIFY(widget3->hasFocus());
+ widget3->clearFocus();
+ QVERIFY(!widget3->focusItem());
+ QCOMPARE(scene.activePanel(), (QGraphicsItem *)widget3);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4, true);
+
+ QGraphicsWidget *widget5 = new QGraphicsWidget; widget5->setData(0, QLatin1String("5"));
+ widget5->setParentItem(widget3);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4, true);
+
+ widget5->setFocusPolicy(Qt::TabFocus);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4 << widget5, true);
+
+ TabFocusWidget *widget6 = new TabFocusWidget("6");
+ widget6->setParentItem(widget4);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4 << widget6 << widget5, true);
+
+ TabFocusWidget *widget7 = new TabFocusWidget("7", widget6);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4 << widget6 << widget7 << widget5, true);
+
+ TabFocusWidget *widget8 = new TabFocusWidget("8", widget6);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4 << widget6 << widget7 << widget8 << widget5, true);
+ widget6->setFlag(QGraphicsItem::ItemIsPanel);
+ widget6->setActive(true);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget6 << widget7 << widget8, true);
+ widget3->setActive(true);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4 << widget5, true);
+ widget6->setFlag(QGraphicsItem::ItemIsPanel, false);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4 << widget6 << widget7 << widget8 << widget5, true);
+ scene.removeItem(widget6);
+ verifyTabFocus(&scene, QList<QGraphicsWidget *>() << widget3 << widget4 << widget5, true);
+ delete widget6;
+}
+
void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
{
QGraphicsScene scene;
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 2d95c9d3a4..f0731eb3a6 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -235,6 +235,8 @@ private slots:
void testDelegateDestroyEditor();
void testClickedSignal();
void testChangeEditorState();
+ void deselectInSingleSelection();
+ void testNoActivateOnDisabledItem();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1599,5 +1601,70 @@ void tst_QAbstractItemView::testChangeEditorState()
// No segfault - the test passes.
}
+void tst_QAbstractItemView::deselectInSingleSelection()
+{
+ QTableView view;
+ QStandardItemModel s;
+ s.setRowCount(10);
+ s.setColumnCount(10);
+ view.setModel(&s);
+ view.show();
+ view.setSelectionMode(QAbstractItemView::SingleSelection);
+ view.setEditTriggers(QAbstractItemView::NoEditTriggers);
+ QApplication::setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ // mouse
+ QModelIndex index22 = s.index(2, 2);
+ QRect rect22 = view.visualRect(index22);
+ QPoint clickpos = rect22.center();
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, clickpos);
+ QCOMPARE(view.currentIndex(), index22);
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1);
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, clickpos);
+ QCOMPARE(view.currentIndex(), index22);
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0);
+
+ // second click with modifier however does select
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, clickpos);
+ QCOMPARE(view.currentIndex(), index22);
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1);
+
+ // keyboard
+ QTest::keyClick(&view, Qt::Key_Space, Qt::NoModifier);
+ QCOMPARE(view.currentIndex(), index22);
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1);
+ QTest::keyClick(&view, Qt::Key_Space, Qt::ControlModifier);
+ QCOMPARE(view.currentIndex(), index22);
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), 0);
+
+ // second keypress with modifier however does select
+ QTest::keyClick(&view, Qt::Key_Space, Qt::ControlModifier);
+ QCOMPARE(view.currentIndex(), index22);
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1);
+}
+
+void tst_QAbstractItemView::testNoActivateOnDisabledItem()
+{
+ QTreeView treeView;
+ QStandardItemModel model(1, 1);
+ QStandardItem *item = new QStandardItem("item");
+ model.setItem(0, 0, item);
+ item->setFlags(Qt::NoItemFlags);
+ treeView.setModel(&model);
+ treeView.show();
+
+ QApplication::setActiveWindow(&treeView);
+ QVERIFY(QTest::qWaitForWindowActive(&treeView));
+
+ QSignalSpy activatedSpy(&treeView, SIGNAL(activated(QModelIndex)));
+
+ // Ensure clicking on a disabled item doesn't emit itemActivated.
+ QModelIndex itemIndex = treeView.model()->index(0, 0);
+ QPoint clickPos = treeView.visualRect(itemIndex).center();
+ QTest::mouseClick(treeView.viewport(), Qt::LeftButton, 0, clickPos);
+
+ QCOMPARE(activatedSpy.count(), 0);
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
index 81736ad0d0..3fa3fbe0ee 100644
--- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp
@@ -165,7 +165,8 @@ public:
QColumnView::setSelection(rect, command);
}
- QRegion visualRegionForSelection(QItemSelection selection){
+ // visualRegionForSelection() is protected in QColumnView.
+ QRegion getVisualRegionForSelection(const QItemSelection &selection){
return QColumnView::visualRegionForSelection(selection);
}
protected:
@@ -664,7 +665,7 @@ void tst_QColumnView::visualRegionForSelection()
{
ColumnView view;
QItemSelection emptyItemSelection;
- QCOMPARE(QRegion(), view.visualRegionForSelection(emptyItemSelection));
+ QCOMPARE(QRegion(), view.getVisualRegionForSelection(emptyItemSelection));
// a region that isn't empty
QDirModel model;
@@ -680,7 +681,7 @@ void tst_QColumnView::visualRegionForSelection()
QModelIndex home = model.index(location);
QVERIFY(model.rowCount(home) > 1);
QItemSelection itemSelection(model.index(0, 0, home), model.index(model.rowCount(home) - 1, 0, home));
- QVERIFY(QRegion() != view.visualRegionForSelection(itemSelection));
+ QVERIFY(QRegion() != view.getVisualRegionForSelection(itemSelection));
}
void tst_QColumnView::moveGrip_basic()
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 63d5389e12..fa67e16db9 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -157,7 +157,7 @@ private slots:
void sortIndicatorTracking();
void removeAndInsertRow();
void unhideSection();
- void event();
+ void testEvent();
void headerDataChanged();
void currentChanged();
void horizontalOffset();
@@ -1368,7 +1368,7 @@ void tst_QHeaderView::unhideSection()
}
-void tst_QHeaderView::event()
+void tst_QHeaderView::testEvent()
{
protected_QHeaderView x(Qt::Vertical);
x.testEvent();
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 0224f9019a..22a1743ff1 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -220,7 +220,7 @@ private slots:
void doLayout();
void rect_data();
void rect();
- void eventFilter();
+ void testEventFilter();
void dateTimeEditor_data();
void dateTimeEditor();
void dateAndTimeEditorTest2();
@@ -695,7 +695,7 @@ void tst_QItemDelegate::rect()
//TODO : Add a test for the keyPress event
//with Qt::Key_Enter and Qt::Key_Return
-void tst_QItemDelegate::eventFilter()
+void tst_QItemDelegate::testEventFilter()
{
TestItemDelegate delegate;
QWidget widget;
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 02d5c5cdb7..113ec1fd30 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -505,11 +505,12 @@ class QMoveCursorListView : public QListView
public:
QMoveCursorListView() : QListView() {}
+ // enum CursorAction and moveCursor() are protected in QListView.
enum CursorAction { MoveUp, MoveDown, MoveLeft, MoveRight,
MoveHome, MoveEnd, MovePageUp, MovePageDown,
MoveNext, MovePrevious };
- QModelIndex moveCursor(QMoveCursorListView::CursorAction action, Qt::KeyboardModifiers modifiers)
+ QModelIndex doMoveCursor(QMoveCursorListView::CursorAction action, Qt::KeyboardModifiers modifiers)
{
return QListView::moveCursor((QListView::CursorAction)action, modifiers);
}
@@ -540,9 +541,9 @@ void tst_QListView::moveCursor2()
vu.selectionModel()->setCurrentIndex(model.index(0,0), QItemSelectionModel::SelectCurrent);
QCoreApplication::processEvents();
- QModelIndex idx = vu.moveCursor(QMoveCursorListView::MoveHome, Qt::NoModifier);
+ QModelIndex idx = vu.doMoveCursor(QMoveCursorListView::MoveHome, Qt::NoModifier);
QCOMPARE(idx, model.index(0,0));
- idx = vu.moveCursor(QMoveCursorListView::MoveDown, Qt::NoModifier);
+ idx = vu.doMoveCursor(QMoveCursorListView::MoveDown, Qt::NoModifier);
QCOMPARE(idx, model.index(8,0));
}
@@ -1628,7 +1629,7 @@ void tst_QListView::task196118_visualRegionForSelection()
class MyListView : public QListView
{
public:
- QRegion visualRegionForSelection() const
+ QRegion getVisualRegionForSelection() const
{ return QListView::visualRegionForSelection( selectionModel()->selection()); }
} view;
@@ -1643,7 +1644,7 @@ void tst_QListView::task196118_visualRegionForSelection()
view.selectionModel()->select(top1.index(), QItemSelectionModel::Select);
QCOMPARE(view.selectionModel()->selectedIndexes().count(), 1);
- QVERIFY(view.visualRegionForSelection().isEmpty());
+ QVERIFY(view.getVisualRegionForSelection().isEmpty());
}
void tst_QListView::task254449_draggingItemToNegativeCoordinates()
@@ -1977,11 +1978,11 @@ void tst_QListView::taskQTBUG_5877_skippingItemInPageDownUp()
vu.selectionModel()->setCurrentIndex(model.index(currentItemIndexes[i], 0),
QItemSelectionModel::SelectCurrent);
- QModelIndex idx = vu.moveCursor(QMoveCursorListView::MovePageDown, Qt::NoModifier);
+ QModelIndex idx = vu.doMoveCursor(QMoveCursorListView::MovePageDown, Qt::NoModifier);
int newCurrent = qMin(currentItemIndexes[i] + scrolledRowCount, 99);
QCOMPARE(idx, model.index(newCurrent, 0));
- idx = vu.moveCursor(QMoveCursorListView::MovePageUp, Qt::NoModifier);
+ idx = vu.doMoveCursor(QMoveCursorListView::MovePageUp, Qt::NoModifier);
newCurrent = qMax(currentItemIndexes[i] - scrolledRowCount, 0);
QCOMPARE(idx, model.index(newCurrent, 0));
}
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 8a679fd1a0..d1107a687c 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -437,6 +437,7 @@ public:
this, SLOT(itemSelectionChanged(QItemSelection,QItemSelection)));
}
+ // enum CursorAction and moveCursor() are protected in QTableView.
enum CursorAction {
MoveUp = QAbstractItemView::MoveUp,
MoveDown = QAbstractItemView::MoveDown,
@@ -450,7 +451,7 @@ public:
MovePrevious = QAbstractItemView::MovePrevious
};
- QModelIndex moveCursor(QtTestTableView::CursorAction cursorAction,
+ QModelIndex doMoveCursor(QtTestTableView::CursorAction cursorAction,
Qt::KeyboardModifiers modifiers)
{
return QTableView::moveCursor((QAbstractItemView::CursorAction)cursorAction, modifiers);
@@ -1192,7 +1193,7 @@ void tst_QTableView::moveCursor()
QModelIndex index = model.index(startRow, startColumn);
view.setCurrentIndex(index);
- QModelIndex newIndex = view.moveCursor((QtTestTableView::CursorAction)cursorMoveAction,
+ QModelIndex newIndex = view.doMoveCursor((QtTestTableView::CursorAction)cursorMoveAction,
(Qt::KeyboardModifiers)modifier);
// expected fails, task 119433
if(newIndex.row() == -1)
@@ -1339,7 +1340,7 @@ void tst_QTableView::moveCursorStrikesBack()
int newRow = -1;
int newColumn = -1;
foreach (int cursorMoveAction, cursorMoveActions) {
- QModelIndex newIndex = view.moveCursor((QtTestTableView::CursorAction)cursorMoveAction, 0);
+ QModelIndex newIndex = view.doMoveCursor((QtTestTableView::CursorAction)cursorMoveAction, 0);
view.setCurrentIndex(newIndex);
newRow = newIndex.row();
newColumn = newIndex.column();
diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
index e64dce1a11..f72467de08 100644
--- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
@@ -1444,7 +1444,7 @@ void tst_QTableWidget::task231094()
tw.setCurrentCell(1, 1);
QCOMPARE(tw.currentRow(), 1);
QCOMPARE(tw.currentColumn(), 1);
-
+
//this would provoke a end-less loop
QTest::keyClick(&tw, '1');
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 0f69e951bf..ea1f846258 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -89,7 +89,8 @@ struct PublicView : public QTreeView
MovePrevious = QAbstractItemView::MovePrevious
};
- inline QModelIndex moveCursor(PublicCursorAction ca, Qt::KeyboardModifiers kbm)
+ // enum PublicCursorAction and moveCursor() are protected in QTreeView.
+ inline QModelIndex doMoveCursor(PublicCursorAction ca, Qt::KeyboardModifiers kbm)
{ return QTreeView::moveCursor((CursorAction)ca, kbm); }
inline void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)
@@ -177,6 +178,7 @@ private slots:
void emptyModel();
void removeRows();
void removeCols();
+ void limitedExpand();
void expandAndCollapse_data();
void expandAndCollapse();
void expandAndCollapseAll();
@@ -256,6 +258,7 @@ private slots:
void taskQTBUG_13567_removeLastItemRegression();
void taskQTBUG_25333_adjustViewOptionsForIndex();
void taskQTBUG_18539_emitLayoutChanged();
+ void taskQTBUG_8176_emitOnExpandAll();
};
class QtTestModel: public QAbstractItemModel
@@ -1414,6 +1417,45 @@ void tst_QTreeView::removeCols()
QCOMPARE(view.header()->count(), model.cols);
}
+void tst_QTreeView::limitedExpand()
+{
+ {
+ QStandardItemModel model;
+ QStandardItem *parentItem = model.invisibleRootItem();
+ parentItem->appendRow(new QStandardItem);
+ parentItem->appendRow(new QStandardItem);
+ parentItem->appendRow(new QStandardItem);
+
+ QStandardItem *firstItem = model.item(0, 0);
+ firstItem->setFlags(firstItem->flags() | Qt::ItemNeverHasChildren);
+
+ QTreeView view;
+ view.setModel(&model);
+
+ QSignalSpy spy(&view, SIGNAL(expanded(QModelIndex)));
+ QVERIFY(spy.isValid());
+
+ view.expand(model.index(0, 0));
+ QCOMPARE(spy.count(), 0);
+
+ view.expand(model.index(1, 0));
+ QCOMPARE(spy.count(), 1);
+ }
+ {
+ QStringListModel model(QStringList() << "one" << "two");
+ QTreeView view;
+ view.setModel(&model);
+
+ QSignalSpy spy(&view, SIGNAL(expanded(QModelIndex)));
+ QVERIFY(spy.isValid());
+
+ view.expand(model.index(0, 0));
+ QCOMPARE(spy.count(), 0);
+ view.expandAll();
+ QCOMPARE(spy.count(), 0);
+ }
+}
+
void tst_QTreeView::expandAndCollapse_data()
{
QTest::addColumn<bool>("animationEnabled");
@@ -1581,13 +1623,10 @@ void tst_QTreeView::expandAndCollapseAll()
for (int r = 0; r < rows; ++r)
parents.push(model.index(r, 0, p));
}
-// ### why is expanded() signal not emitted?
-// QCOMPARE(expandedSpy.count(), count);
+ QCOMPARE(expandedSpy.count(), 12); // == (3+1)*(2+1) from QtTestModel model(3, 2);
view.collapseAll();
- QCOMPARE(expandedSpy.count(), 0);
-
parents.push(QModelIndex());
count = 0;
while (!parents.isEmpty()) {
@@ -1599,8 +1638,7 @@ void tst_QTreeView::expandAndCollapseAll()
for (int r = 0; r < rows; ++r)
parents.push(model.index(r, 0, p));
}
-// ### why is collapsed() signal not emitted?
-// QCOMPARE(collapsedSpy.count(), count);
+ QCOMPARE(collapsedSpy.count(), 12);
}
void tst_QTreeView::expandWithNoChildren()
@@ -1765,7 +1803,7 @@ void tst_QTreeView::moveCursor()
QCOMPARE(view.currentIndex(), expected);
//then pressing down should go to the next line
- QModelIndex actual = view.moveCursor(PublicView::MoveDown, Qt::NoModifier);
+ QModelIndex actual = view.doMoveCursor(PublicView::MoveDown, Qt::NoModifier);
expected = model.index(2, 1, QModelIndex());
QCOMPARE(actual, expected);
@@ -1774,7 +1812,7 @@ void tst_QTreeView::moveCursor()
// PageUp was broken with uniform row heights turned on
view.setCurrentIndex(model.index(1, 0));
- actual = view.moveCursor(PublicView::MovePageUp, Qt::NoModifier);
+ actual = view.doMoveCursor(PublicView::MovePageUp, Qt::NoModifier);
expected = model.index(0, 0, QModelIndex());
QCOMPARE(actual, expected);
@@ -2818,7 +2856,7 @@ void tst_QTreeView::evilModel()
view.setSelection(rect, QItemSelectionModel::Select);
model.change();
- view.moveCursor(PublicView::MoveDown, Qt::NoModifier);
+ view.doMoveCursor(PublicView::MoveDown, Qt::NoModifier);
model.change();
view.resizeColumnToContents(1);
@@ -4158,6 +4196,47 @@ void tst_QTreeView::taskQTBUG_18539_emitLayoutChanged()
QCOMPARE(afterRISpy.size(), 0);
}
+void tst_QTreeView::taskQTBUG_8176_emitOnExpandAll()
+{
+ QTreeWidget tw;
+ QTreeWidgetItem *item = new QTreeWidgetItem(&tw, QStringList(QString("item 1")));
+ QTreeWidgetItem *item2 = new QTreeWidgetItem(item, QStringList(QString("item 2")));
+ new QTreeWidgetItem(item2, QStringList(QString("item 3")));
+ new QTreeWidgetItem(item2, QStringList(QString("item 4")));
+ QTreeWidgetItem *item5 = new QTreeWidgetItem(&tw, QStringList(QString("item 5")));
+ new QTreeWidgetItem(item5, QStringList(QString("item 6")));
+ QSignalSpy spy(&tw, SIGNAL(expanded(const QModelIndex&)));
+
+ // expand all
+ tw.expandAll();
+ QCOMPARE(spy.size(), 6);
+ spy.clear();
+ tw.collapseAll();
+ item2->setExpanded(true);
+ spy.clear();
+ tw.expandAll();
+ QCOMPARE(spy.size(), 5);
+
+ // collapse all
+ QSignalSpy spy2(&tw, SIGNAL(collapsed(const QModelIndex&)));
+ tw.collapseAll();
+ QCOMPARE(spy2.size(), 6);
+ tw.expandAll();
+ item2->setExpanded(false);
+ spy2.clear();
+ tw.collapseAll();
+ QCOMPARE(spy2.size(), 5);
+
+ // expand to depth
+ item2->setExpanded(true);
+ spy.clear();
+ spy2.clear();
+ tw.expandToDepth(0);
+
+ QCOMPARE(spy.size(), 2); // item and item5 are expanded
+ QCOMPARE(spy2.size(), 1); // item2 is collapsed
+}
+
#ifndef QT_NO_ANIMATION
void tst_QTreeView::quickExpandCollapse()
{
diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
index 7ab68345fa..f1f9f1c01a 100644
--- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp
@@ -80,6 +80,7 @@ private slots:
void updateIteratorAfterDeletedItem_and_ContinueIteration_data();
void updateIteratorAfterDeletedItem_and_ContinueIteration();
void initializeIterator();
+ void sortingEnabled();
private:
QTreeWidget *testWidget;
};
@@ -1236,5 +1237,31 @@ void tst_QTreeWidgetItemIterator::initializeIterator()
QCOMPARE((*it), static_cast<QTreeWidgetItem*>(0));
}
+void tst_QTreeWidgetItemIterator::sortingEnabled()
+{
+ QTreeWidget *tree = new QTreeWidget;
+ tree->setColumnCount(2);
+ tree->headerItem()->setText(0, "Id");
+ tree->headerItem()->setText(1, "Color");
+
+ tree->setSortingEnabled(true);
+ tree->sortByColumn(0, Qt::AscendingOrder);
+
+ QTreeWidgetItem *second = new QTreeWidgetItem;
+ second->setText(0, "2");
+ second->setText(1, "second");
+ QTreeWidgetItem *first = new QTreeWidgetItem;
+ first->setText(0, "1");
+ first->setText(1, "first");
+
+ tree->addTopLevelItem(second);
+ tree->addTopLevelItem(first);
+
+ QTreeWidgetItemIterator it(tree);
+ QCOMPARE(*it, first);
+ ++it;
+ QCOMPARE(*it, second);
+}
+
QTEST_MAIN(tst_QTreeWidgetItemIterator)
#include "tst_qtreewidgetitemiterator.moc"
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro
index b280f44f05..20720dc928 100644
--- a/tests/auto/widgets/kernel/kernel.pro
+++ b/tests/auto/widgets/kernel/kernel.pro
@@ -15,6 +15,7 @@ SUBDIRS=\
qwidgetaction \
qwidgetmetatype \
qwidgetsvariant \
+ qwindowcontainer \
qshortcut \
qsizepolicy
diff --git a/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp b/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp
index e24c21feab..e935cfd53a 100644
--- a/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp
+++ b/tests/auto/widgets/kernel/qapplication/wincmdline/main.cpp
@@ -40,14 +40,15 @@
****************************************************************************/
#include <QApplication>
#include <stdio.h>
-int main(int argc, char *argv[])
+
+int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QApplication app(argc, argv);
if (argc > 1)
fprintf(stderr, "%s", argv[1]);
else
fprintf(stderr, "Failed");
fflush(stderr);
- return 0;
+ return 0;
}
diff --git a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp
index 63ffc13c68..4efe8c4273 100644
--- a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp
+++ b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <QtWidgets/QDesktopWidget>
+#include <QtGui/QWindow>
#include <QDebug>
class tst_QDesktopWidget : public QObject
@@ -63,6 +64,7 @@ private slots:
void screenNumberForQPoint();
void availableGeometry();
void screenGeometry();
+ void topLevels();
};
tst_QDesktopWidget::tst_QDesktopWidget()
@@ -177,6 +179,21 @@ void tst_QDesktopWidget::screenGeometry()
}
}
+void tst_QDesktopWidget::topLevels()
+{
+ // Desktop widgets/windows should not be listed as top-levels.
+ int topLevelDesktopWidgets = 0;
+ int topLevelDesktopWindows = 0;
+ foreach (const QWidget *w, QApplication::topLevelWidgets())
+ if (w->windowType() == Qt::Desktop)
+ topLevelDesktopWidgets++;
+ foreach (const QWindow *w, QGuiApplication::topLevelWindows())
+ if (w->type() == Qt::Desktop)
+ topLevelDesktopWindows++;
+ QCOMPARE(topLevelDesktopWidgets, 0);
+ QCOMPARE(topLevelDesktopWindows, 0);
+}
+
QTEST_MAIN(tst_QDesktopWidget)
#include "tst_qdesktopwidget.moc"
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index d77dd003d7..b970de8e87 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -169,11 +169,11 @@ void tst_QFormLayout::rowCount()
fl->addRow(tr("Label 2"), new QLineEdit);
fl->addRow(tr("Label 3"), new QLineEdit);
QCOMPARE(fl->rowCount(), 3);
-
+
fl->addRow(new QWidget);
fl->addRow(new QHBoxLayout);
QCOMPARE(fl->rowCount(), 5);
-
+
fl->insertRow(1, tr("Label 0.5"), new QLineEdit);
QCOMPARE(fl->rowCount(), 6);
@@ -206,7 +206,7 @@ void tst_QFormLayout::buddies()
fl->addRow(le3);
QWidget *label3 = fl->labelForField(le3);
QVERIFY(label3 == 0);
-
+
//TODO: empty label?
delete w;
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index f830ead6c0..2b9b4fd761 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -155,7 +155,7 @@ void tst_QLayout::geometry()
void tst_QLayout::smartMaxSize()
{
- QVector<int> expectedWidths;
+ QVector<int> expectedWidths;
QFile f(QFINDTESTDATA("baseline/smartmaxsize"));
@@ -170,9 +170,9 @@ void tst_QLayout::smartMaxSize()
f.close();
int sizeCombinations[] = { 0, 10, 20, QWIDGETSIZE_MAX};
- QSizePolicy::Policy policies[] = { QSizePolicy::Fixed,
- QSizePolicy::Minimum,
- QSizePolicy::Maximum,
+ QSizePolicy::Policy policies[] = { QSizePolicy::Fixed,
+ QSizePolicy::Minimum,
+ QSizePolicy::Maximum,
QSizePolicy::Preferred,
QSizePolicy::Expanding,
QSizePolicy::MinimumExpanding,
@@ -250,7 +250,7 @@ void tst_QLayout::setContentsMargins()
MyLayout layout;
layout.invalidated = false;
int left, top, right, bottom;
-
+
layout.setContentsMargins(52, 53, 54, 55);
QVERIFY(layout.invalidated);
layout.invalidated = false;
@@ -260,7 +260,7 @@ void tst_QLayout::setContentsMargins()
QCOMPARE(top, 53);
QCOMPARE(right, 54);
QCOMPARE(bottom, 55);
-
+
layout.setContentsMargins(52, 53, 54, 55);
QVERIFY(!layout.invalidated);
}
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index 2d3e3c1702..441277ef53 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
@@ -132,7 +132,7 @@ void tst_QToolTip::whatsThis()
{
qApp->setStyleSheet( "QWidget { font-size: 72px; }" );
QWhatsThis::showText(QPoint(0,0), "THis is text");
- QTest::qWait(400);
+ QTest::qWait(400);
QWidget *whatsthis = 0;
foreach (QWidget *widget, QApplication::topLevelWidgets()) {
if (widget->inherits("QWhatsThat")) {
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index f9ee2e485a..252d47f698 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -412,6 +412,7 @@ private slots:
void keyboardModifiers();
void mouseDoubleClickBubbling_QTBUG29680();
+ void largerThanScreen_QTBUG30142();
private:
bool ensureScreenSize(int width, int height);
@@ -5632,6 +5633,7 @@ void tst_QWidget::showHideShowX11()
qApp->installNativeEventFilter(&w);
w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
w.hide();
QEventLoop eventLoop;
@@ -10079,5 +10081,20 @@ void tst_QWidget::mouseDoubleClickBubbling_QTBUG29680()
QTRY_VERIFY(parent.triggered);
}
+void tst_QWidget::largerThanScreen_QTBUG30142()
+{
+ QWidget widget;
+ widget.resize(200, 4000);
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ QVERIFY(widget.frameGeometry().y() >= 0);
+
+ QWidget widget2;
+ widget2.resize(10000, 400);
+ widget2.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget2));
+ QVERIFY(widget2.frameGeometry().x() >= 0);
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/.gitignore b/tests/auto/widgets/kernel/qwindowcontainer/.gitignore
new file mode 100644
index 0000000000..038f477220
--- /dev/null
+++ b/tests/auto/widgets/kernel/qwindowcontainer/.gitignore
@@ -0,0 +1 @@
+tst_qwindowcontainer
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro
new file mode 100644
index 0000000000..4ff05eb04a
--- /dev/null
+++ b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro
@@ -0,0 +1,6 @@
+CONFIG += testcase
+mac:CONFIG -= app_bundle
+# CONFIG += parallel_test // Cannot be parallel due to the activation test
+TARGET = tst_qwindowcontainer
+QT += widgets testlib
+SOURCES += tst_qwindowcontainer.cpp
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
new file mode 100644
index 0000000000..440639cd49
--- /dev/null
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 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.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <qapplication.h>
+#include <qwindow.h>
+#include <qwidget.h>
+
+
+
+class Window : public QWindow
+{
+public:
+ Window()
+ : numberOfExposes(0)
+ , numberOfObscures(0)
+ {
+ }
+
+ void exposeEvent(QExposeEvent *) {
+ if (isExposed())
+ ++numberOfExposes;
+ else
+ ++numberOfObscures;
+ }
+
+ int numberOfExposes;
+ int numberOfObscures;
+};
+
+
+
+class tst_QWindowContainer: public QObject
+{
+ Q_OBJECT
+private slots:
+ void testShow();
+ void testPositionAndSize();
+ void testExposeObscure();
+ void testOwnership();
+ void testBehindTheScenesDeletion();
+ void testUnparenting();
+ void testActivation();
+};
+
+
+
+void tst_QWindowContainer::testShow()
+{
+ QWidget root;
+ root.setGeometry(100, 100, 400, 400);
+
+ Window *window = new Window();
+ QWidget *container = QWidget::createWindowContainer(window, &root);
+
+ container->setGeometry(50, 50, 200, 200);
+
+ root.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+}
+
+
+
+void tst_QWindowContainer::testPositionAndSize()
+{
+ QWindow *window = new QWindow();
+ window->setGeometry(300, 400, 500, 600);
+
+ QWidget *container = QWidget::createWindowContainer(window);
+ container->setGeometry(50, 50, 200, 200);
+
+
+ container->show();
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+
+ QCOMPARE(window->x(), 0);
+ QCOMPARE(window->y(), 0);
+ QCOMPARE(window->width(), container->width());
+ QCOMPARE(window->height(), container->height());
+}
+
+
+
+void tst_QWindowContainer::testExposeObscure()
+{
+ Window *window = new Window();
+
+ QWidget *container = QWidget::createWindowContainer(window);
+ container->setGeometry(50, 50, 200, 200);
+
+ container->show();
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->numberOfExposes > 0);
+
+ container->hide();
+
+ QElapsedTimer timer;
+ timer.start();
+ while (window->numberOfObscures == 0 && timer.elapsed() < 5000) {
+ QTest::qWait(10);
+ }
+
+ QVERIFY(window->numberOfObscures > 0);
+}
+
+
+
+void tst_QWindowContainer::testOwnership()
+{
+ QPointer<QWindow> window(new QWindow());
+ QWidget *container = QWidget::createWindowContainer(window);
+
+ delete container;
+
+ QCOMPARE(window.data(), (QWindow *) 0);
+}
+
+
+
+void tst_QWindowContainer::testBehindTheScenesDeletion()
+{
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window);
+
+ delete window;
+
+ // The child got removed, showing not should not have any side effects,
+ // such as for instance, crashing...
+ container->show();
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+ delete container;
+}
+
+
+
+void tst_QWindowContainer::testActivation()
+{
+ QWidget root;
+
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window, &root);
+
+ container->setGeometry(100, 100, 200, 100);
+ root.setGeometry(100, 100, 400, 300);
+
+ root.show();
+ root.activateWindow();
+
+ QVERIFY(QTest::qWaitForWindowActive(root.windowHandle()));
+ QVERIFY(QGuiApplication::focusWindow() == root.windowHandle());
+
+ // Under KDE (ubuntu 12.10), we experience that doing two activateWindow in a row
+ // does not work. The second gets ignored by the window manager, even though the
+ // timestamp in the xcb connection is unique for both.
+ if (QGuiApplication::platformName() == "xcb")
+ QTest::qWait(100);
+
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(QGuiApplication::focusWindow() == window);
+}
+
+
+
+void tst_QWindowContainer::testUnparenting()
+{
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window);
+ container->setGeometry(100, 100, 200, 100);
+
+ window->setParent(0);
+
+ container->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(container));
+
+ // Window should not be made visible by container..
+ QVERIFY(!window->isVisible());
+}
+
+QTEST_MAIN(tst_QWindowContainer)
+
+#include "tst_qwindowcontainer.moc"
diff --git a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
index 12e9fe451c..7925820b70 100644
--- a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
+++ b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
@@ -117,7 +117,7 @@ void tst_QMacStyle::sizeHints_data()
void tst_QMacStyle::sizeHints()
{
- QFETCH(Size, size);
+ QFETCH(Size, size);
QDialog w;
setSize(&w, size);
@@ -234,7 +234,7 @@ void tst_QMacStyle::layoutMargins_data()
void tst_QMacStyle::layoutMargins()
{
- QFETCH(Size, size);
+ QFETCH(Size, size);
QWidget w;
setSize(&w, size);
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index cf867194cc..c733fadbf5 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -234,7 +234,10 @@ void tst_QStyle::testProxyStyle()
QVERIFY(proxyStyle->baseStyle());
qApp->setStyle(proxyStyle);
- QProxyStyle doubleProxy(new QProxyStyle(QStyleFactory::create("Windows")));
+ QProxyStyle* baseStyle = new QProxyStyle("Windows");
+ QCOMPARE(baseStyle->baseStyle()->objectName(), style->objectName());
+
+ QProxyStyle doubleProxy(baseStyle);
QVERIFY(testAllFunctions(&doubleProxy));
CustomProxy customStyle;
@@ -738,7 +741,7 @@ public:
void tst_QStyle::testDrawingShortcuts()
{
- {
+ {
QWidget w;
setFrameless(&w);
QToolButton *tb = new QToolButton(&w);
@@ -768,14 +771,14 @@ void tst_QStyle::testDrawingShortcuts()
bool showMnemonic = dts->styleHint(QStyle::SH_UnderlineShortcut, &sotb, tb);
QVERIFY(dts->alignment & (showMnemonic ? Qt::TextShowMnemonic : Qt::TextHideMnemonic));
delete dts;
- }
+ }
}
#define SCROLLBAR_SPACING 33
class FrameTestStyle : public QProxyStyle {
public:
- FrameTestStyle() : QProxyStyle(QStyleFactory::create("Windows")) { }
+ FrameTestStyle() : QProxyStyle("Windows") { }
int styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const {
if (hint == QStyle::SH_ScrollView_FrameOnlyAroundContents)
return 1;
diff --git a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp
index 1203e12045..8a00198cf1 100644
--- a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp
+++ b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp
@@ -44,7 +44,7 @@
#include <QStyleOption>
-class tst_QStyleOption: public QObject
+class tst_QStyleOption: public QObject
{
Q_OBJECT
@@ -54,7 +54,7 @@ private slots:
void copyconstructors();
};
-// Just a simple container for QStyleOption-pointer
+// Just a simple container for QStyleOption-pointer
struct StyleOptionPointerBase
{
QStyleOption *pointer;
@@ -80,7 +80,7 @@ void tst_QStyleOption::qstyleoptioncast_data()
{
QTest::addColumn<StyleOptionPointerBase *>("testOption");
QTest::addColumn<bool>("canCastToComplex");
- QTest::addColumn<int>("type");
+ QTest::addColumn<int>("type");
QTest::newRow("optionDefault") << stylePtr(new QStyleOption) << false << int(QStyleOption::SO_Default);
QTest::newRow("optionButton") << stylePtr(new QStyleOptionButton) << false << int(QStyleOption::SO_Button);
diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
index a53da5275c..bbd71a9284 100644
--- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
+++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp
@@ -363,6 +363,9 @@ void tst_QScroller::scrollerProperties()
void tst_QScroller::scrollTo()
{
+#ifdef Q_OS_MAC
+ QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-29950");
+#endif
{
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
sw->scrollArea = QRectF( 0, 0, 1000, 1000 );
@@ -389,11 +392,9 @@ void tst_QScroller::scrollTo()
void tst_QScroller::scroll()
{
-#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
- QSKIP("Mac OS X < 10.6 does not support QTouchEvents");
- return;
+#ifdef Q_OS_MAC
+ QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-30133");
#endif
-
#ifndef QT_NO_GESTURES
// -- good case. normal scroll
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
@@ -436,11 +437,9 @@ void tst_QScroller::scroll()
void tst_QScroller::overshoot()
{
-#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
- QSKIP("Mac OS X < 10.6 does not support QTouchEvents");
- return;
+#ifdef Q_OS_MAC
+ QSKIP("Flakey test - https://bugreports.qt-project.org/browse/QTBUG-29950");
#endif
-
#ifndef QT_NO_GESTURES
tst_QScrollerWidget *sw = new tst_QScrollerWidget();
sw->scrollArea = QRectF(0, 0, 1000, 1000);
diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
index c8a12a9866..ddab98ebc6 100644
--- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
@@ -599,7 +599,7 @@ void tst_QUndoGroup::addStackAndDie()
{
// Test that QUndoStack doesn't keep a reference to QUndoGroup after the
// group is deleted.
- QUndoStack *stack = new QUndoStack;
+ QUndoStack *stack = new QUndoStack;
QUndoGroup *group = new QUndoGroup;
group->addStack(stack);
delete group;
diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
index 9b48dc7798..4556816655 100644
--- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
+++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
@@ -290,52 +290,52 @@ static void checkState(QSignalSpy &redoTextChangedSpy,
const bool _undoChanged,
const bool _redoChanged)
{
- QCOMPARE(stack.count(), _count);
- QCOMPARE(stack.isClean(), _clean);
- QCOMPARE(stack.index(), _index);
- QCOMPARE(stack.canUndo(), _canUndo);
- QCOMPARE(stack.undoText(), QString(_undoText));
- QCOMPARE(stack.canRedo(), _canRedo);
- QCOMPARE(stack.redoText(), QString(_redoText));
- if (_indexChanged) {
- QCOMPARE(indexChangedSpy.count(), 1);
- QCOMPARE(indexChangedSpy.at(0).at(0).toInt(), _index);
- indexChangedSpy.clear();
- } else {
- QCOMPARE(indexChangedSpy.count(), 0);
- }
- if (_cleanChanged) {
- QCOMPARE(cleanChangedSpy.count(), 1);
- QCOMPARE(cleanChangedSpy.at(0).at(0).toBool(), _clean);
- cleanChangedSpy.clear();
- } else {
- QCOMPARE(cleanChangedSpy.count(), 0);
- }
- if (_undoChanged) {
- QCOMPARE(canUndoChangedSpy.count(), 1);
- QCOMPARE(canUndoChangedSpy.at(0).at(0).toBool(), _canUndo);
- QCOMPARE(undoAction->isEnabled(), _canUndo);
- QCOMPARE(undoTextChangedSpy.count(), 1);
- QCOMPARE(undoTextChangedSpy.at(0).at(0).toString(), QString(_undoText));
- QCOMPARE(undoAction->text(), glue("foo", _undoText));
- canUndoChangedSpy.clear();
- undoTextChangedSpy.clear();
- } else {
- QCOMPARE(canUndoChangedSpy.count(), 0);
- QCOMPARE(undoTextChangedSpy.count(), 0);
- }
- if (_redoChanged) {
- QCOMPARE(canRedoChangedSpy.count(), 1);
- QCOMPARE(canRedoChangedSpy.at(0).at(0).toBool(), _canRedo);
- QCOMPARE(redoAction->isEnabled(), _canRedo);
- QCOMPARE(redoTextChangedSpy.count(), 1);
- QCOMPARE(redoTextChangedSpy.at(0).at(0).toString(), QString(_redoText));
- QCOMPARE(redoAction->text(), glue("bar", _redoText));
- canRedoChangedSpy.clear();
- redoTextChangedSpy.clear();
- } else {
- QCOMPARE(canRedoChangedSpy.count(), 0);
- QCOMPARE(redoTextChangedSpy.count(), 0);
+ QCOMPARE(stack.count(), _count);
+ QCOMPARE(stack.isClean(), _clean);
+ QCOMPARE(stack.index(), _index);
+ QCOMPARE(stack.canUndo(), _canUndo);
+ QCOMPARE(stack.undoText(), QString(_undoText));
+ QCOMPARE(stack.canRedo(), _canRedo);
+ QCOMPARE(stack.redoText(), QString(_redoText));
+ if (_indexChanged) {
+ QCOMPARE(indexChangedSpy.count(), 1);
+ QCOMPARE(indexChangedSpy.at(0).at(0).toInt(), _index);
+ indexChangedSpy.clear();
+ } else {
+ QCOMPARE(indexChangedSpy.count(), 0);
+ }
+ if (_cleanChanged) {
+ QCOMPARE(cleanChangedSpy.count(), 1);
+ QCOMPARE(cleanChangedSpy.at(0).at(0).toBool(), _clean);
+ cleanChangedSpy.clear();
+ } else {
+ QCOMPARE(cleanChangedSpy.count(), 0);
+ }
+ if (_undoChanged) {
+ QCOMPARE(canUndoChangedSpy.count(), 1);
+ QCOMPARE(canUndoChangedSpy.at(0).at(0).toBool(), _canUndo);
+ QCOMPARE(undoAction->isEnabled(), _canUndo);
+ QCOMPARE(undoTextChangedSpy.count(), 1);
+ QCOMPARE(undoTextChangedSpy.at(0).at(0).toString(), QString(_undoText));
+ QCOMPARE(undoAction->text(), glue("foo", _undoText));
+ canUndoChangedSpy.clear();
+ undoTextChangedSpy.clear();
+ } else {
+ QCOMPARE(canUndoChangedSpy.count(), 0);
+ QCOMPARE(undoTextChangedSpy.count(), 0);
+ }
+ if (_redoChanged) {
+ QCOMPARE(canRedoChangedSpy.count(), 1);
+ QCOMPARE(canRedoChangedSpy.at(0).at(0).toBool(), _canRedo);
+ QCOMPARE(redoAction->isEnabled(), _canRedo);
+ QCOMPARE(redoTextChangedSpy.count(), 1);
+ QCOMPARE(redoTextChangedSpy.at(0).at(0).toString(), QString(_redoText));
+ QCOMPARE(redoAction->text(), glue("bar", _redoText));
+ canRedoChangedSpy.clear();
+ redoTextChangedSpy.clear();
+ } else {
+ QCOMPARE(canRedoChangedSpy.count(), 0);
+ QCOMPARE(redoTextChangedSpy.count(), 0);
}
}
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 9ecb0650c5..53c3eb1ed0 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -316,7 +316,6 @@ void tst_QDateTimeEdit::getSetCheck()
tst_QDateTimeEdit::tst_QDateTimeEdit()
{
- qRegisterMetaType<QList<int> >("QList<int>");
}
tst_QDateTimeEdit::~tst_QDateTimeEdit()
@@ -759,6 +758,11 @@ void tst_QDateTimeEdit::displayFormat()
void tst_QDateTimeEdit::selectAndScrollWithKeys()
{
+#ifdef Q_OS_MAC
+ QSKIP("QTBUG-23674");
+ return;
+#endif
+
qApp->setActiveWindow(testWidget);
testWidget->setDate(QDate(2004, 05, 11));
testWidget->setDisplayFormat("dd/MM/yyyy");
@@ -769,9 +773,6 @@ void tst_QDateTimeEdit::selectAndScrollWithKeys()
QTest::keyClick(testWidget, Qt::Key_Home);
#endif
QTest::keyClick(testWidget, Qt::Key_Right, Qt::ShiftModifier);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23674", Abort);
-#endif
QCOMPARE(testWidget->lineEdit()->selectedText(), QString("1"));
QTest::keyClick(testWidget, Qt::Key_Right, Qt::ShiftModifier);
QCOMPARE(testWidget->lineEdit()->selectedText(), QString("11"));
@@ -3426,11 +3427,11 @@ void tst_QDateTimeEdit::deleteCalendarWidget()
edit.setCalendarPopup(true);
QVERIFY(edit.calendarWidget());
edit.calendarWidget()->setObjectName("cw1");;
-
+
// delete
cw = edit.calendarWidget();
delete cw;
-
+
// it should create a new widget
QVERIFY(edit.calendarWidget());
QVERIFY(edit.calendarWidget()->objectName() != "cw1");
diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index c7c9980f13..59be9bd659 100644
--- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -68,8 +68,8 @@ public slots:
private slots:
void standardButtons();
void testConstructor1();
- void testConstrurtor2();
- void testConstrurtor2_data();
+ void testConstructor2();
+ void testConstructor2_data();
void testConstructor3();
void testConstructor3_data();
void setOrientation_data();
@@ -146,7 +146,7 @@ void tst_QDialogButtonBox::layoutReuse()
delete box;
}
-void tst_QDialogButtonBox::testConstrurtor2_data()
+void tst_QDialogButtonBox::testConstructor2_data()
{
QTest::addColumn<int>("orientation");
@@ -154,7 +154,7 @@ void tst_QDialogButtonBox::testConstrurtor2_data()
QTest::newRow("vertical") << int(Qt::Vertical);
}
-void tst_QDialogButtonBox::testConstrurtor2()
+void tst_QDialogButtonBox::testConstructor2()
{
QFETCH(int, orientation);
Qt::Orientation orient = Qt::Orientation(orientation);
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 6e3432b575..896d4e8e6f 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -59,7 +59,7 @@
#include "../../../qtest-config.h"
-static uchar restoreData41[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 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0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0xd6, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xb8, 0x0, 0x0, 0x0, 0xa0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0xfc, 0x0, 0x0, 0x0, 0x0};
// Local scope class to simulate toolbar move.
@@ -1273,7 +1273,7 @@ void tst_QMainWindow::restoreStateFromPreviousVersion()
QMainWindow win;
win.setCentralWidget(new QTextEdit);
QVector<QDockWidget*> docks;
-
+
for(int i = 0; i < 16; ++i) {
const QString name = QString::fromLatin1("dock %1").arg(i);
QDockWidget *dock = new QDockWidget(name);
@@ -1288,7 +1288,7 @@ void tst_QMainWindow::restoreStateFromPreviousVersion()
QCOMPARE( win.dockWidgetArea(docks[i]), Qt::DockWidgetArea(1 << i%4));
}
}
-
+
}
@@ -1631,7 +1631,7 @@ void tst_QMainWindow::isSeparator()
QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height())));
QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + margin)));
QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 15)));
-
+
}
class MainWindow : public QMainWindow {
@@ -1668,7 +1668,7 @@ void tst_QMainWindow::addToolbarAfterShow()
//this is for task 243119
QMainWindow mainWindow;
mainWindow.show();
-
+
QToolBar toolBar;
mainWindow.addToolBar(&toolBar);
QTest::qWait(100);
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 6364727e0e..72945a9fd2 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -290,7 +290,6 @@ private slots:
private:
QMdiSubWindow *activeWindow;
- bool accelPressed;
};
tst_QMdiArea::tst_QMdiArea()
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 354ccea06c..519aa61061 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -1122,7 +1122,6 @@ void tst_QMenuBar::check_menuPosition()
void tst_QMenuBar::task223138_triggered()
{
- qRegisterMetaType<QAction *>("QAction *");
//we create a window with submenus and we check that both menubar and menus get the triggered signal
QMainWindow win;
QMenu *menu = win.menuBar()->addMenu("test");
diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
index 0696aa11d2..e373e50e0a 100644
--- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include "qprogressbar.h"
+#include <qlocale.h>
#include <qapplication.h>
#include <qstyleoption.h>
#include <qdebug.h>
@@ -64,6 +65,7 @@ private slots:
void sizeHint();
void formatedText_data();
void formatedText();
+ void localizedFormattedText();
void task245201_testChangeStyleAndDelete_data();
void task245201_testChangeStyleAndDelete();
@@ -310,6 +312,40 @@ void tst_QProgressBar::formatedText()
QCOMPARE(bar.text(), text);
}
+void tst_QProgressBar::localizedFormattedText() // QTBUG-28751
+{
+ QProgressBar bar;
+ const int value = 42;
+ bar.setValue(value);
+ const QString defaultExpectedNumber = QString::number(value);
+ const QString defaultExpectedValue = defaultExpectedNumber + QLatin1Char('%');
+ QCOMPARE(bar.text(), defaultExpectedValue);
+
+ // Temporarily switch to Egyptian, which has a different percent sign and number formatting
+ QLocale egypt(QLocale::Arabic, QLocale::Egypt);
+ bar.setLocale(egypt);
+ const QString egyptianExpectedNumber = egypt.toString(value);
+ const QString egyptianExpectedValue = egyptianExpectedNumber + egypt.percent();
+ if (egyptianExpectedValue == defaultExpectedValue)
+ QSKIP("Egyptian locale does not work on this system.");
+ QCOMPARE(bar.text(), egyptianExpectedValue);
+
+ bar.setLocale(QLocale());
+ QCOMPARE(bar.text(), defaultExpectedValue);
+
+ // Set a custom format containing only the number
+ bar.setFormat(QStringLiteral("%p"));
+ QCOMPARE(bar.text(), defaultExpectedNumber);
+ bar.setLocale(egypt);
+ QCOMPARE(bar.text(), egyptianExpectedNumber);
+
+ // Clear the format
+ bar.resetFormat();
+ QCOMPARE(bar.text(), egyptianExpectedValue);
+ bar.setLocale(QLocale());
+ QCOMPARE(bar.text(), defaultExpectedValue);
+}
+
void tst_QProgressBar::task245201_testChangeStyleAndDelete_data()
{
QTest::addColumn<QString>("style1_str");
diff --git a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
index 26daf11b3a..a1a4e33a4b 100644
--- a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
+++ b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
@@ -120,7 +120,7 @@ void tst_QScrollArea::ensureMicroFocusVisible_Task_167838()
parent->setLayout(new QVBoxLayout);
QWidget *child = new WidgetWithMicroFocus;
parent->layout()->addWidget(child);
- parent->resize(300, 300);
+ parent->resize(300, 300);
scrollArea.setWidget(parent);
scrollArea.ensureWidgetVisible(child, 10, 10);
QRect microFocus = child->inputMethodQuery(Qt::ImMicroFocus).toRect();
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index a2c7c04977..340eefbf17 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -242,17 +242,17 @@ void tst_QSplitter::saveAndRestoreState()
QFETCH(IntList, initialSizes);
splitter->setSizes(initialSizes);
QApplication::instance()->sendPostedEvents();
-
+
QSplitter *splitter2 = new QSplitter(splitter->orientation() == Qt::Horizontal ?
Qt::Vertical : Qt::Horizontal);
for (int i = 0; i < splitter->count(); ++i) {
- splitter2->addWidget(new QWidget());
+ splitter2->addWidget(new QWidget());
}
- splitter2->resize(splitter->size());
+ splitter2->resize(splitter->size());
splitter2->setChildrenCollapsible(!splitter->childrenCollapsible());
splitter2->setOpaqueResize(!splitter->opaqueResize());
splitter2->setHandleWidth(splitter->handleWidth()+3);
-
+
QByteArray ba = splitter->saveState();
QVERIFY(splitter2->restoreState(ba));
@@ -269,10 +269,10 @@ void tst_QSplitter::saveAndRestoreState()
}
// destroy version and magic number
- for (int i = 0; i < ba.size(); ++i)
+ for (int i = 0; i < ba.size(); ++i)
ba[i] = ~ba.at(i);
QVERIFY(!splitter2->restoreState(ba));
-
+
delete splitter2;
}
@@ -688,7 +688,7 @@ void tst_QSplitter::task187373_addAbstractScrollAreas()
}
//! A simple QTextEdit which can switch between two different size states
-class MyTextEdit : public QTextEdit
+class MyTextEdit : public QTextEdit
{
public:
MyTextEdit(const QString & text, QWidget* parent = NULL)
diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
index 48cbc66ba9..5dd9ee9b0f 100644
--- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
@@ -454,7 +454,7 @@ void tst_QTabWidget::removeTab()
tw->addTab(new QLabel("5"), "5");
QCOMPARE(ob.count, 1);
QCOMPARE(tw->count(), 5);
-
+
tw->setCurrentIndex(4);
QCOMPARE(ob.count,5);
tw->removeTab(4);
@@ -533,7 +533,7 @@ void tst_QTabWidget::keyboardNavigation()
tw->setTabEnabled(2, false);
QTest::keyClick(tw, Qt::Key_Tab, Qt::ControlModifier);
// TODO: Disabling the current tab will move current tab to the next,
- // but what if next tab is also disabled. We should look into this.
+ // but what if next tab is also disabled. We should look into this.
QVERIFY(tw->currentIndex() < 3 && tw->currentIndex() >= 0);
}