summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/BLACKLIST2
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp43
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp13
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST4
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp16
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST16
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp369
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/BLACKLIST6
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST2
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp4
-rw-r--r--tests/auto/widgets/effects/qgraphicseffect/BLACKLIST3
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp13
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST8
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST28
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp24
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qcolumnview/BLACKLIST2
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/BLACKLIST2
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp8
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro2
-rw-r--r--tests/auto/widgets/itemviews/qlistview/qlistview.pro2
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qtableview/BLACKLIST3
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp45
-rw-r--r--tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp4
-rw-r--r--tests/auto/widgets/kernel/kernel.pro2
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp60
-rw-r--r--tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp81
-rw-r--r--tests/auto/widgets/kernel/qapplication/BLACKLIST4
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp8
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp70
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp8
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp12
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp750
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST40
-rw-r--r--tests/auto/widgets/kernel/qwidget/qwidget.pro2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp39
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/BLACKLIST4
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp5
-rw-r--r--tests/auto/widgets/util/qcompleter/BLACKLIST6
-rw-r--r--tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp10
-rw-r--r--tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp32
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp27
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp40
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp6
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST4
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp26
-rw-r--r--tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp20
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/BLACKLIST19
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp3
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp7
-rw-r--r--tests/auto/widgets/widgets/qmenu/BLACKLIST12
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp21
-rw-r--r--tests/auto/widgets/widgets/qmenubar/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp3
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/BLACKLIST6
-rw-r--r--tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp2
-rw-r--r--tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp4
-rw-r--r--tests/auto/widgets/widgets/qscrollbar/BLACKLIST3
-rw-r--r--tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp7
-rw-r--r--tests/auto/widgets/widgets/qspinbox/BLACKLIST3
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp32
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp2
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro2
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp4
-rw-r--r--tests/auto/widgets/widgets/qtextbrowser/heading.html2
-rw-r--r--tests/auto/widgets/widgets/qtextbrowser/markdown.md2
-rw-r--r--tests/auto/widgets/widgets/qtextbrowser/markdown.really2
-rw-r--r--tests/auto/widgets/widgets/qtextbrowser/qtextbrowser.pro2
-rw-r--r--tests/auto/widgets/widgets/qtextbrowser/quotesAndFractions.md1
-rw-r--r--tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp92
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp37
-rw-r--r--tests/auto/widgets/widgets/qtoolbutton/BLACKLIST2
83 files changed, 1278 insertions, 911 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/BLACKLIST b/tests/auto/widgets/dialogs/qdialog/BLACKLIST
index dd6a8bfff9..72e3dff6dd 100644
--- a/tests/auto/widgets/dialogs/qdialog/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qdialog/BLACKLIST
@@ -1,4 +1,4 @@
[snapToDefaultButton]
-osx
+osx-10.14
[showFullScreen]
osx-10.13 ci
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index c840dabc1a..a494d7119a 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -52,7 +52,9 @@ class DummyDialog : public QDialog
{
public:
DummyDialog(): QDialog() {}
+#if QT_DEPRECATED_SINCE(5, 13)
using QDialog::showExtension;
+#endif
};
class tst_QDialog : public QObject
@@ -64,8 +66,10 @@ public:
private slots:
void cleanup();
void getSetCheck();
+#if QT_DEPRECATED_SINCE(5, 13)
void showExtension_data();
void showExtension();
+#endif
void defaultButtons();
void showMaximized();
void showMinimized();
@@ -76,6 +80,9 @@ private slots:
void deleteInExec();
#if QT_CONFIG(sizegrip)
void showSizeGrip();
+#if QT_DEPRECATED_SINCE(5, 13)
+ void showSizeGrip_deprecated();
+#endif
#endif
void setVisible();
void reject();
@@ -89,6 +96,7 @@ private slots:
void tst_QDialog::getSetCheck()
{
QDialog obj1;
+#if QT_DEPRECATED_SINCE(5, 13)
// QWidget* QDialog::extension()
// void QDialog::setExtension(QWidget*)
QWidget *var1 = new QWidget;
@@ -97,6 +105,7 @@ void tst_QDialog::getSetCheck()
obj1.setExtension((QWidget *)0);
QCOMPARE((QWidget *)0, obj1.extension());
// No delete var1, since setExtension takes ownership
+#endif
// int QDialog::result()
// void QDialog::setResult(int)
@@ -146,6 +155,7 @@ void tst_QDialog::cleanup()
QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
+#if QT_DEPRECATED_SINCE(5, 13)
void tst_QDialog::showExtension_data()
{
QTest::addColumn<QSize>("dlgSize");
@@ -197,6 +207,7 @@ void tst_QDialog::showExtension()
testWidget.setExtension( 0 );
}
+#endif
void tst_QDialog::defaultButtons()
{
@@ -422,9 +433,37 @@ void tst_QDialog::deleteInExec()
}
#if QT_CONFIG(sizegrip)
+
// From Task 124269
void tst_QDialog::showSizeGrip()
{
+ QDialog dialog(nullptr);
+ dialog.show();
+ QWidget *ext = new QWidget(&dialog);
+ QVERIFY(!dialog.isSizeGripEnabled());
+
+ dialog.setSizeGripEnabled(true);
+ QPointer<QSizeGrip> sizeGrip = dialog.findChild<QSizeGrip *>();
+ QVERIFY(sizeGrip);
+ QVERIFY(sizeGrip->isVisible());
+ QVERIFY(dialog.isSizeGripEnabled());
+
+ dialog.setSizeGripEnabled(false);
+ QVERIFY(!dialog.isSizeGripEnabled());
+
+ dialog.setSizeGripEnabled(true);
+ sizeGrip = dialog.findChild<QSizeGrip *>();
+ QVERIFY(sizeGrip);
+ QVERIFY(sizeGrip->isVisible());
+ sizeGrip->hide();
+ dialog.hide();
+ dialog.show();
+ QVERIFY(!sizeGrip->isVisible());
+}
+
+#if QT_DEPRECATED_SINCE(5, 13)
+void tst_QDialog::showSizeGrip_deprecated()
+{
QDialog dialog(0);
dialog.show();
QWidget *ext = new QWidget(&dialog);
@@ -476,7 +515,9 @@ void tst_QDialog::showSizeGrip()
dialog.show();
QVERIFY(!sizeGrip->isVisible());
}
-#endif
+#endif // QT_DEPRECATED_SINCE(5, 13)
+
+#endif // QT_CONFIG(sizegrip)
void tst_QDialog::setVisible()
{
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 748c8aaa84..2131e45f29 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -800,7 +800,10 @@ void tst_QFiledialog::isReadOnly()
QAction* renameAction = fd.findChild<QAction*>("qt_rename_action");
QAction* deleteAction = fd.findChild<QAction*>("qt_delete_action");
+#if QT_DEPRECATED_SINCE(5, 13)
QCOMPARE(fd.isReadOnly(), false);
+#endif
+ QCOMPARE(fd.testOption(QFileDialog::ReadOnly), false);
// This is dependent upon the file/dir, find cross platform way to test
//fd.setDirectory(QDir::home());
@@ -1421,6 +1424,16 @@ void tst_QFiledialog::clearLineEdit()
QTRY_VERIFY(fd.directory().absolutePath() != workDirPath);
QVERIFY(lineEdit->text().isEmpty());
+
+ // QTBUG-71415: When pressing back, the selection (activated
+ // directory) should be restored.
+ QToolButton *backButton = fd.findChild<QToolButton*>("backButton");
+ QVERIFY(backButton);
+ QTreeView *treeView = fd.findChildren<QTreeView*>("treeView").value(0);
+ QVERIFY(treeView);
+ backButton->click();
+ QTRY_COMPARE(treeView->selectionModel()->selectedIndexes().value(0).data().toString(),
+ dirName);
}
void tst_QFiledialog::enableChooseButton()
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST b/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST
index e0887d8ad1..875855b59e 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST
@@ -1,2 +1,4 @@
[QTBUG4419_lineEditSelectAll]
-osx
+osx-10.12
+osx-10.14
+osx-10.13
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index 869418371c..40eff1e4c3 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -378,24 +378,24 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior()
// defaults
QVERIFY(openContextMenu(fd));
QCOMPARE(fd.selectedFiles(), QStringList(ctx.file.fileName()));
- QCOMPARE(rm->isEnabled(), !fd.isReadOnly());
- QCOMPARE(mv->isEnabled(), !fd.isReadOnly());
+ QCOMPARE(rm->isEnabled(), !fd.testOption(QFileDialog::ReadOnly));
+ QCOMPARE(mv->isEnabled(), !fd.testOption(QFileDialog::ReadOnly));
// change to non-defaults:
- fd.setReadOnly(!fd.isReadOnly());
+ fd.setOption(QFileDialog::ReadOnly, !fd.testOption(QFileDialog::ReadOnly));
QVERIFY(openContextMenu(fd));
QCOMPARE(fd.selectedFiles().size(), 1);
- QCOMPARE(rm->isEnabled(), !fd.isReadOnly());
- QCOMPARE(mv->isEnabled(), !fd.isReadOnly());
+ QCOMPARE(rm->isEnabled(), !fd.testOption(QFileDialog::ReadOnly));
+ QCOMPARE(mv->isEnabled(), !fd.testOption(QFileDialog::ReadOnly));
// and changed back to defaults:
- fd.setReadOnly(!fd.isReadOnly());
+ fd.setOption(QFileDialog::ReadOnly, !fd.testOption(QFileDialog::ReadOnly));
QVERIFY(openContextMenu(fd));
QCOMPARE(fd.selectedFiles().size(), 1);
- QCOMPARE(rm->isEnabled(), !fd.isReadOnly());
- QCOMPARE(mv->isEnabled(), !fd.isReadOnly());
+ QCOMPARE(rm->isEnabled(), !fd.testOption(QFileDialog::ReadOnly));
+ QCOMPARE(mv->isEnabled(), !fd.testOption(QFileDialog::ReadOnly));
}
#endif // !QT_NO_CONTEXTMENU && !QT_NO_MENU
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST
index f78d23c6b1..f2f0f8d26e 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/BLACKLIST
@@ -1,13 +1,19 @@
winrt
+[sort]
+winrt
[sort:QFileDialog usage]
ubuntu
b2qt
[specialFiles]
-ubuntu
b2qt
[dirsBeforeFiles]
-ubuntu
+ubuntu-16.04
+rhel-7.6
+windows-10 msvc-2017
+ubuntu-18.04
b2qt
-windows
-rhel
-suse-leap
+winrt
+windows-10 msvc-2015
+
+[drives]
+winrt
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 665a116a3a..f8f40e8488 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -65,18 +65,18 @@
} \
} while(0)
-class tst_QFileSystemModel : public QObject {
- Q_OBJECT
+Q_DECLARE_METATYPE(QDir::Filters)
+Q_DECLARE_METATYPE(QFileDevice::Permissions)
-public:
- tst_QFileSystemModel();
+Q_LOGGING_CATEGORY(lcFileSystemModel, "qt.widgets.tests.qfilesystemmodel")
-public Q_SLOTS:
- void init();
- void cleanup();
+class tst_QFileSystemModel : public QObject {
+ Q_OBJECT
private slots:
void initTestCase();
+ void cleanup();
+
void indexPath();
void rootPath();
@@ -128,48 +128,33 @@ private slots:
void fileInfo();
protected:
- bool createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount = 0, const QStringList &intial_dirs = QStringList());
- QModelIndex prepareTestModelRoot(const QString &test_path, QSignalSpy **spy2 = nullptr,
- QSignalSpy **spy3 = nullptr);
+ bool createFiles(QFileSystemModel *model, const QString &test_path,
+ const QStringList &initial_files, int existingFileCount = 0,
+ const QStringList &initial_dirs = QStringList());
+ QModelIndex prepareTestModelRoot(QFileSystemModel *model, const QString &test_path,
+ QSignalSpy **spy2 = nullptr, QSignalSpy **spy3 = nullptr);
private:
- QFileSystemModel *model;
QString flatDirTestPath;
QTemporaryDir m_tempDir;
};
-tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
-{
-}
-
-void tst_QFileSystemModel::init()
-{
- cleanup();
- QCOMPARE(model, nullptr);
- model = new QFileSystemModel;
-}
-
void tst_QFileSystemModel::cleanup()
{
- delete model;
- model = 0;
- QString tmp = flatDirTestPath;
- QDir dir(tmp);
- if (dir.exists(tmp)) {
- QStringList list = dir.entryList(QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot);
- for (int i = 0; i < list.count(); ++i) {
- QFileInfo fi(dir.path() + '/' + list.at(i));
- if (fi.exists() && fi.isFile()) {
- QFile p(fi.absoluteFilePath());
- p.setPermissions(QFile::ReadUser | QFile::ReadOwner | QFile::ExeOwner | QFile::ExeUser | QFile::WriteUser | QFile::WriteOwner | QFile::WriteOther);
- QFile dead(dir.path() + '/' + list.at(i));
- dead.remove();
+ QDir dir(flatDirTestPath);
+ if (dir.exists()) {
+ const QDir::Filters filters = QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot;
+ const QFileInfoList list = dir.entryInfoList(filters);
+ for (const QFileInfo &fi : list) {
+ if (fi.isDir()) {
+ QVERIFY(dir.rmdir(fi.fileName()));
+ } else {
+ QFile dead(fi.absoluteFilePath());
+ dead.setPermissions(QFile::ReadUser | QFile::ReadOwner | QFile::ExeOwner | QFile::ExeUser | QFile::WriteUser | QFile::WriteOwner | QFile::WriteOther);
+ QVERIFY(dead.remove());
}
- if (fi.exists() && fi.isDir())
- QVERIFY(dir.rmdir(list.at(i)));
}
- list = dir.entryList(QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot);
- QCOMPARE(list.count(), 0);
+ QVERIFY(dir.entryInfoList(filters).isEmpty());
}
}
@@ -182,6 +167,7 @@ void tst_QFileSystemModel::initTestCase()
void tst_QFileSystemModel::indexPath()
{
#if !defined(Q_OS_WIN)
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
int depth = QDir::currentPath().count('/');
model->setRootPath(QDir::currentPath());
QString backPath;
@@ -195,9 +181,10 @@ void tst_QFileSystemModel::indexPath()
void tst_QFileSystemModel::rootPath()
{
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
QCOMPARE(model->rootPath(), QString(QDir().path()));
- QSignalSpy rootChanged(model, SIGNAL(rootPathChanged(QString)));
+ QSignalSpy rootChanged(model.data(), &QFileSystemModel::rootPathChanged);
QModelIndex root = model->setRootPath(model->rootPath());
root = model->setRootPath("this directory shouldn't exist");
QCOMPARE(rootChanged.count(), 0);
@@ -243,6 +230,7 @@ void tst_QFileSystemModel::rootPath()
void tst_QFileSystemModel::readOnly()
{
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
QCOMPARE(model->isReadOnly(), true);
QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
QVERIFY2(file.open(), qPrintable(file.errorString()));
@@ -263,19 +251,21 @@ void tst_QFileSystemModel::readOnly()
class CustomFileIconProvider : public QFileIconProvider
{
public:
- CustomFileIconProvider() : QFileIconProvider() {
- mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical);
- dvd = qApp->style()->standardIcon(QStyle::SP_DriveDVDIcon);
+ CustomFileIconProvider() : QFileIconProvider()
+ {
+ auto style = QApplication::style();
+ mb = style->standardIcon(QStyle::SP_MessageBoxCritical);
+ dvd = style->standardIcon(QStyle::SP_DriveDVDIcon);
}
- virtual QIcon icon(const QFileInfo &info) const
+ QIcon icon(const QFileInfo &info) const override
{
if (info.isDir())
return mb;
return QFileIconProvider::icon(info);
}
- virtual QIcon icon(IconType type) const
+ QIcon icon(IconType type) const override
{
if (type == QFileIconProvider::Folder)
return dvd;
@@ -289,69 +279,67 @@ private:
void tst_QFileSystemModel::iconProvider()
{
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
QVERIFY(model->iconProvider());
- QFileIconProvider *p = new QFileIconProvider();
- model->setIconProvider(p);
- QCOMPARE(model->iconProvider(), p);
- model->setIconProvider(0);
- delete p;
+ QScopedPointer<QFileIconProvider> provider(new QFileIconProvider);
+ model->setIconProvider(provider.data());
+ QCOMPARE(model->iconProvider(), provider.data());
+ model->setIconProvider(nullptr);
+ provider.reset();
- QFileSystemModel *myModel = new QFileSystemModel();
+ QScopedPointer<QFileSystemModel> myModel(new QFileSystemModel);
const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
QVERIFY(!documentPaths.isEmpty());
- const QString documentPath = documentPaths.front();
- myModel->setRootPath(documentPath);
+ myModel->setRootPath(documentPaths.constFirst());
//We change the provider, icons must be updated
- CustomFileIconProvider *custom = new CustomFileIconProvider();
- myModel->setIconProvider(custom);
+ provider.reset(new CustomFileIconProvider);
+ myModel->setIconProvider(provider.data());
- QPixmap mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(50, 50);
+ QPixmap mb = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(50, 50);
QCOMPARE(myModel->fileIcon(myModel->index(QDir::homePath())).pixmap(50, 50), mb);
- delete myModel;
- delete custom;
}
-bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs)
+bool tst_QFileSystemModel::createFiles(QFileSystemModel *model, const QString &test_path,
+ const QStringList &initial_files, int existingFileCount,
+ const QStringList &initial_dirs)
{
- //qDebug() << (model->rowCount(model->index(test_path))) << existingFileCount << initial_files;
+ qCDebug(lcFileSystemModel) << (model->rowCount(model->index(test_path))) << existingFileCount << initial_files;
bool timedOut = false;
TRY_WAIT((model->rowCount(model->index(test_path)) == existingFileCount), &timedOut);
if (timedOut)
return false;
- for (int i = 0; i < initial_dirs.count(); ++i) {
- QDir dir(test_path);
- if (!dir.exists()) {
- qWarning() << "error" << test_path << "doesn't exists";
- return false;
- }
- if(!dir.mkdir(initial_dirs.at(i))) {
- qWarning() << "error" << "failed to make" << initial_dirs.at(i);
+ QDir dir(test_path);
+ if (!dir.exists()) {
+ qWarning() << "error" << test_path << "doesn't exist";
+ return false;
+ }
+ for (const auto &initial_dir : initial_dirs) {
+ if (!dir.mkdir(initial_dir)) {
+ qWarning() << "error" << "failed to make" << initial_dir;
return false;
}
- //qDebug() << test_path + '/' + initial_dirs.at(i) << (QFile::exists(test_path + '/' + initial_dirs.at(i)));
+ qCDebug(lcFileSystemModel) << test_path + '/' + initial_dir << (QFile::exists(test_path + '/' + initial_dir));
}
- for (int i = 0; i < initial_files.count(); ++i) {
- QFile file(test_path + '/' + initial_files.at(i));
+ for (const auto &initial_file : initial_files) {
+ QFile file(test_path + '/' + initial_file);
if (!file.open(QIODevice::WriteOnly | QIODevice::Append)) {
- qDebug() << "failed to open file" << initial_files.at(i);
+ qDebug() << "failed to open file" << initial_file;
return false;
}
if (!file.resize(1024 + file.size())) {
- qDebug() << "failed to resize file" << initial_files.at(i);
+ qDebug() << "failed to resize file" << initial_file;
return false;
}
if (!file.flush()) {
- qDebug() << "failed to flush file" << initial_files.at(i);
+ qDebug() << "failed to flush file" << initial_file;
return false;
}
file.close();
#if defined(Q_OS_WIN)
- if (initial_files.at(i)[0] == '.') {
- QString hiddenFile = QDir::toNativeSeparators(file.fileName());
- wchar_t nativeHiddenFile[MAX_PATH];
- memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
- hiddenFile.toWCharArray(nativeHiddenFile);
+ if (initial_file[0] == '.') {
+ const QString hiddenFile = QDir::toNativeSeparators(file.fileName());
+ const auto nativeHiddenFile = reinterpret_cast<const wchar_t *>(hiddenFile.utf16());
#ifndef Q_OS_WINRT
DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile);
#else // !Q_OS_WINRT
@@ -370,13 +358,13 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
}
}
#endif
- //qDebug() << test_path + '/' + initial_files.at(i) << (QFile::exists(test_path + '/' + initial_files.at(i)));
+ qCDebug(lcFileSystemModel) << test_path + '/' + initial_file << (QFile::exists(test_path + '/' + initial_file));
}
return true;
}
-QModelIndex tst_QFileSystemModel::prepareTestModelRoot(const QString &test_path, QSignalSpy **spy2,
- QSignalSpy **spy3)
+QModelIndex tst_QFileSystemModel::prepareTestModelRoot(QFileSystemModel *model, const QString &test_path,
+ QSignalSpy **spy2, QSignalSpy **spy3)
{
if (model->rowCount(model->index(test_path)) != 0)
return QModelIndex();
@@ -387,9 +375,8 @@ QModelIndex tst_QFileSystemModel::prepareTestModelRoot(const QString &test_path,
*spy3 = new QSignalSpy(model, &QFileSystemModel::rowsAboutToBeInserted);
QStringList files = { "b", "d", "f", "h", "j", ".a", ".c", ".e", ".g" };
- QString l = "b,d,f,h,j,.a,.c,.e,.g";
- if (!createFiles(test_path, files))
+ if (!createFiles(model, test_path, files))
return QModelIndex();
QModelIndex root = model->setRootPath(test_path);
@@ -406,10 +393,10 @@ QModelIndex tst_QFileSystemModel::prepareTestModelRoot(const QString &test_path,
void tst_QFileSystemModel::rowCount()
{
- const QString tmp = flatDirTestPath;
QSignalSpy *spy2 = nullptr;
QSignalSpy *spy3 = nullptr;
- QModelIndex root = prepareTestModelRoot(flatDirTestPath, &spy2, &spy3);
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QModelIndex root = prepareTestModelRoot(model.data(), flatDirTestPath, &spy2, &spy3);
QVERIFY(root.isValid());
QVERIFY(spy2 && spy2->count() > 0);
@@ -419,11 +406,11 @@ void tst_QFileSystemModel::rowCount()
void tst_QFileSystemModel::rowsInserted_data()
{
QTest::addColumn<int>("count");
- QTest::addColumn<int>("ascending");
+ QTest::addColumn<Qt::SortOrder>("ascending");
for (int i = 0; i < 4; ++i) {
const QByteArray iB = QByteArray::number(i);
- QTest::newRow(("Qt::AscendingOrder " + iB).constData()) << i << (int)Qt::AscendingOrder;
- QTest::newRow(("Qt::DescendingOrder " + iB).constData()) << i << (int)Qt::DescendingOrder;
+ QTest::newRow(("Qt::AscendingOrder " + iB).constData()) << i << Qt::AscendingOrder;
+ QTest::newRow(("Qt::DescendingOrder " + iB).constData()) << i << Qt::DescendingOrder;
}
}
@@ -436,20 +423,21 @@ static inline QString lastEntry(const QModelIndex &root)
void tst_QFileSystemModel::rowsInserted()
{
const QString tmp = flatDirTestPath;
- QModelIndex root = prepareTestModelRoot(tmp);
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QModelIndex root = prepareTestModelRoot(model.data(), tmp);
QVERIFY(root.isValid());
- QFETCH(int, ascending);
+ QFETCH(Qt::SortOrder, ascending);
QFETCH(int, count);
- model->sort(0, (Qt::SortOrder)ascending);
+ model->sort(0, ascending);
- QSignalSpy spy0(model, SIGNAL(rowsInserted(QModelIndex,int,int)));
- QSignalSpy spy1(model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
+ QSignalSpy spy0(model.data(), &QAbstractItemModel::rowsInserted);
+ QSignalSpy spy1(model.data(), &QAbstractItemModel::rowsAboutToBeInserted);
int oldCount = model->rowCount(root);
QStringList files;
for (int i = 0; i < count; ++i)
files.append(QLatin1Char('c') + QString::number(i));
- QVERIFY(createFiles(tmp, files, 5));
+ QVERIFY(createFiles(model.data(), tmp, files, 5));
QTRY_COMPARE(model->rowCount(root), oldCount + count);
int totalRowsInserted = 0;
for (int i = 0; i < spy0.count(); ++i) {
@@ -469,7 +457,7 @@ void tst_QFileSystemModel::rowsInserted()
}
if (count == 0) QCOMPARE(spy1.count(), 0); else QVERIFY(spy1.count() >= 1);
- QVERIFY(createFiles(tmp, QStringList(".hidden_file"), 5 + count));
+ QVERIFY(createFiles(model.data(), tmp, QStringList(".hidden_file"), 5 + count));
if (count != 0)
QTRY_VERIFY(spy0.count() >= 1);
@@ -489,19 +477,21 @@ void tst_QFileSystemModel::rowsRemoved_data()
void tst_QFileSystemModel::rowsRemoved()
{
const QString tmp = flatDirTestPath;
- QModelIndex root = prepareTestModelRoot(tmp);
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QModelIndex root = prepareTestModelRoot(model.data(), tmp);
QVERIFY(root.isValid());
QFETCH(int, count);
- QFETCH(int, ascending);
- model->sort(0, (Qt::SortOrder)ascending);
+ QFETCH(Qt::SortOrder, ascending);
+ model->sort(0, ascending);
- QSignalSpy spy0(model, SIGNAL(rowsRemoved(QModelIndex,int,int)));
- QSignalSpy spy1(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
+ QSignalSpy spy0(model.data(), &QAbstractItemModel::rowsRemoved);
+ QSignalSpy spy1(model.data(), &QAbstractItemModel::rowsAboutToBeRemoved);
int oldCount = model->rowCount(root);
for (int i = count - 1; i >= 0; --i) {
- //qDebug() << "removing" << model->index(i, 0, root).data().toString();
- QVERIFY(QFile::remove(tmp + '/' + model->index(i, 0, root).data().toString()));
+ const QString fileName = model->index(i, 0, root).data().toString();
+ qCDebug(lcFileSystemModel) << "removing" << fileName;
+ QVERIFY(QFile::remove(tmp + QLatin1Char('/') + fileName));
}
for (int i = 0 ; i < 10; ++i) {
if (count != 0) {
@@ -520,18 +510,23 @@ void tst_QFileSystemModel::rowsRemoved()
lst.append(model->index(i, 0, root).data().toString());
if (model->rowCount(root) == oldCount - count)
break;
- qDebug() << "still have:" << lst << QFile::exists(tmp + '/' + QString(".a"));
+ qCDebug(lcFileSystemModel) << "still have:" << lst << QFile::exists(tmp + QLatin1String("/.a"));
QDir tmpLister(tmp);
- qDebug() << tmpLister.entryList();
+ qCDebug(lcFileSystemModel) << tmpLister.entryList();
}
QTRY_COMPARE(model->rowCount(root), oldCount - count);
- QVERIFY(QFile::exists(tmp + '/' + QString(".a")));
- QVERIFY(QFile::remove(tmp + '/' + QString(".a")));
- QVERIFY(QFile::remove(tmp + '/' + QString(".c")));
+ QVERIFY(QFile::exists(tmp + QLatin1String("/.a")));
+ QVERIFY(QFile::remove(tmp + QLatin1String("/.a")));
+ QVERIFY(QFile::remove(tmp + QLatin1String("/.c")));
- if (count != 0) QVERIFY(spy0.count() >= 1); else QCOMPARE(spy0.count(), 0);
- if (count != 0) QVERIFY(spy1.count() >= 1); else QCOMPARE(spy1.count(), 0);
+ if (count != 0) {
+ QVERIFY(spy0.count() >= 1);
+ QVERIFY(spy1.count() >= 1);
+ } else {
+ QCOMPARE(spy0.count(), 0);
+ QCOMPARE(spy1.count(), 0);
+ }
}
void tst_QFileSystemModel::dataChanged_data()
@@ -544,18 +539,19 @@ void tst_QFileSystemModel::dataChanged()
QSKIP("This can't be tested right now since we don't watch files, only directories.");
const QString tmp = flatDirTestPath;
- QModelIndex root = prepareTestModelRoot(tmp);
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QModelIndex root = prepareTestModelRoot(model.data(), tmp);
QVERIFY(root.isValid());
QFETCH(int, count);
- QFETCH(int, assending);
- model->sort(0, (Qt::SortOrder)assending);
+ QFETCH(Qt::SortOrder, ascending);
+ model->sort(0, ascending);
- QSignalSpy spy(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
+ QSignalSpy spy(model.data(), &QAbstractItemModel::dataChanged);
QStringList files;
for (int i = 0; i < count; ++i)
files.append(model->index(i, 0, root).data().toString());
- createFiles(tmp, files);
+ createFiles(model.data(), tmp, files);
QTest::qWait(WAITTIME);
@@ -566,64 +562,68 @@ void tst_QFileSystemModel::filters_data()
{
QTest::addColumn<QStringList>("files");
QTest::addColumn<QStringList>("dirs");
- QTest::addColumn<int>("dirFilters");
+ QTest::addColumn<QDir::Filters>("dirFilters");
QTest::addColumn<QStringList>("nameFilters");
QTest::addColumn<int>("rowCount");
- QTest::newRow("no dirs") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs) << QStringList() << 2;
- QTest::newRow("no dirs - dot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 1;
- QTest::newRow("no dirs - dotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 1;
- QTest::newRow("no dirs - dotanddotdot") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 0;
- QTest::newRow("one dir - dot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDot) << QStringList() << 2;
- QTest::newRow("one dir - dotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotDot) << QStringList() << 2;
- QTest::newRow("one dir - dotanddotdot") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 1;
- QTest::newRow("one dir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") << (int)(QDir::Dirs) << QStringList() << 3;
- QTest::newRow("no dir + hidden") << (QStringList() << "a" << "b" << "c") << QStringList() << (int)(QDir::Dirs | QDir::Hidden) << QStringList() << 2;
- QTest::newRow("dir+hid+files") << (QStringList() << "a" << "b" << "c") << QStringList() <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden) << QStringList() << 5;
- QTest::newRow("dir+file+hid-dot .A") << (QStringList() << "a" << "b" << "c") << (QStringList() << ".A") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList() << 4;
- QTest::newRow("dir+files+hid+dot A") << (QStringList() << "a" << "b" << "c") << (QStringList() << "AFolder") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << (QStringList() << "A*") << 2;
- QTest::newRow("dir+files+hid+dot+cas1") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "Z") << 1;
- QTest::newRow("dir+files+hid+dot+cas2") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << (QStringList() << "a") << 1;
- QTest::newRow("dir+files+hid+dot+cas+alldir") << (QStringList() << "a" << "b" << "c") << (QStringList() << "Z") <<
- (int)(QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << (QStringList() << "Z") << 1;
-
- QTest::newRow("case sensitive") << (QStringList() << "Antiguagdb" << "Antiguamtd"
- << "Antiguamtp" << "afghanistangdb" << "afghanistanmtd")
- << QStringList() << (int)(QDir::Files) << QStringList() << 5;
+
+ const QStringList abcList{QLatin1String("a"), QLatin1String("b"), QLatin1String("c")};
+ const QStringList zList{QLatin1String("Z")};
+
+ QTest::newRow("no dirs") << abcList << QStringList() << QDir::Filters(QDir::Dirs) << QStringList() << 2;
+ QTest::newRow("no dirs - dot") << abcList << QStringList() << (QDir::Dirs | QDir::NoDot) << QStringList() << 1;
+ QTest::newRow("no dirs - dotdot") << abcList << QStringList() << (QDir::Dirs | QDir::NoDotDot) << QStringList() << 1;
+ QTest::newRow("no dirs - dotanddotdot") << abcList << QStringList() << (QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 0;
+ QTest::newRow("one dir - dot") << abcList << zList << (QDir::Dirs | QDir::NoDot) << QStringList() << 2;
+ QTest::newRow("one dir - dotdot") << abcList << zList << (QDir::Dirs | QDir::NoDotDot) << QStringList() << 2;
+ QTest::newRow("one dir - dotanddotdot") << abcList << zList << (QDir::Dirs | QDir::NoDotAndDotDot) << QStringList() << 1;
+ QTest::newRow("one dir") << abcList << zList << QDir::Filters(QDir::Dirs) << QStringList() << 3;
+ QTest::newRow("no dir + hidden") << abcList << QStringList() << (QDir::Dirs | QDir::Hidden) << QStringList() << 2;
+ QTest::newRow("dir+hid+files") << abcList << QStringList() <<
+ (QDir::Dirs | QDir::Files | QDir::Hidden) << QStringList() << 5;
+ QTest::newRow("dir+file+hid-dot .A") << abcList << QStringList{QLatin1String(".A")} <<
+ (QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList() << 4;
+ QTest::newRow("dir+files+hid+dot A") << abcList << QStringList{QLatin1String("AFolder")} <<
+ (QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot) << QStringList{QLatin1String("A*")} << 2;
+ QTest::newRow("dir+files+hid+dot+cas1") << abcList << zList <<
+ (QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << zList << 1;
+ QTest::newRow("dir+files+hid+dot+cas2") << abcList << zList <<
+ (QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive) << QStringList{QLatin1String("a")} << 1;
+ QTest::newRow("dir+files+hid+dot+cas+alldir") << abcList << zList <<
+ (QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot | QDir::CaseSensitive | QDir::AllDirs) << zList << 1;
+
+ QTest::newRow("case sensitive") << QStringList{QLatin1String("Antiguagdb"), QLatin1String("Antiguamtd"),
+ QLatin1String("Antiguamtp"), QLatin1String("afghanistangdb"), QLatin1String("afghanistanmtd")}
+ << QStringList() << QDir::Filters(QDir::Files) << QStringList() << 5;
}
void tst_QFileSystemModel::filters()
{
QString tmp = flatDirTestPath;
- QVERIFY(createFiles(tmp, QStringList()));
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QVERIFY(createFiles(model.data(), tmp, QStringList()));
QModelIndex root = model->setRootPath(tmp);
QFETCH(QStringList, files);
QFETCH(QStringList, dirs);
- QFETCH(int, dirFilters);
+ QFETCH(QDir::Filters, dirFilters);
QFETCH(QStringList, nameFilters);
QFETCH(int, rowCount);
if (nameFilters.count() > 0)
model->setNameFilters(nameFilters);
model->setNameFilterDisables(false);
- model->setFilter((QDir::Filters)dirFilters);
+ model->setFilter(dirFilters);
- QVERIFY(createFiles(tmp, files, 0, dirs));
+ QVERIFY(createFiles(model.data(), tmp, files, 0, dirs));
QTRY_COMPARE(model->rowCount(root), rowCount);
// Make sure that we do what QDir does
QDir xFactor(tmp);
- QDir::Filters filters = (QDir::Filters)dirFilters;
QStringList dirEntries;
if (nameFilters.count() > 0)
- dirEntries = xFactor.entryList(nameFilters, filters);
+ dirEntries = xFactor.entryList(nameFilters, dirFilters);
else
- dirEntries = xFactor.entryList(filters);
+ dirEntries = xFactor.entryList(dirFilters);
QCOMPARE(dirEntries.count(), rowCount);
@@ -667,12 +667,13 @@ void tst_QFileSystemModel::nameFilters()
{
QStringList list;
list << "a" << "b" << "c";
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
model->setNameFilters(list);
model->setNameFilterDisables(false);
QCOMPARE(model->nameFilters(), list);
QString tmp = flatDirTestPath;
- QVERIFY(createFiles(tmp, list));
+ QVERIFY(createFiles(model.data(), tmp, list));
QModelIndex root = model->setRootPath(tmp);
QTRY_COMPARE(model->rowCount(root), 3);
@@ -693,15 +694,17 @@ void tst_QFileSystemModel::setData_data()
<< QDir::temp().absolutePath() + '/' + "a"
<< false;
*/
+
+ const QStringList abcList{QLatin1String("a"), QLatin1String("b"), QLatin1String("c")};
QTest::newRow("in current dir")
<< QString()
- << (QStringList() << "a" << "b" << "c")
+ << abcList
<< "a"
<< "d"
<< true;
QTest::newRow("in subdir")
<< "s"
- << (QStringList() << "a" << "b" << "c")
+ << abcList
<< "a"
<< "d"
<< true;
@@ -709,7 +712,8 @@ void tst_QFileSystemModel::setData_data()
void tst_QFileSystemModel::setData()
{
- QSignalSpy spy(model, SIGNAL(fileRenamed(QString,QString,QString)));
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QSignalSpy spy(model.data(), &QFileSystemModel::fileRenamed);
QFETCH(QString, subdirName);
QFETCH(QStringList, files);
QFETCH(QString, oldFileName);
@@ -722,7 +726,7 @@ void tst_QFileSystemModel::setData()
QVERIFY(dir.mkdir(subdirName));
tmp.append('/' + subdirName);
}
- QVERIFY(createFiles(tmp, files));
+ QVERIFY(createFiles(model.data(), tmp, files));
QModelIndex tmpIdx = model->setRootPath(flatDirTestPath);
if (!subdirName.isEmpty()) {
tmpIdx = model->index(tmp);
@@ -760,6 +764,7 @@ void tst_QFileSystemModel::sortPersistentIndex()
const QFileInfo fileInfo(file.fileName());
file.close();
QTRY_VERIFY(QDir(flatDirTestPath).entryInfoList().contains(fileInfo));
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
QModelIndex root = model->setRootPath(flatDirTestPath);
QTRY_VERIFY(model->rowCount(root) > 0);
@@ -786,8 +791,9 @@ void tst_QFileSystemModel::sort()
{
QFETCH(bool, fileDialogMode);
- MyFriendFileSystemModel *myModel = new MyFriendFileSystemModel();
- QTreeView *tree = new QTreeView();
+ QScopedPointer<MyFriendFileSystemModel> myModel(new MyFriendFileSystemModel);
+ QTreeView tree;
+ tree.setWindowTitle(QTest::currentTestFunction());
if (fileDialogMode && EmulationDetector::isRunningArmOnX86())
QSKIP("Crashes in QEMU. QTBUG-70572");
@@ -816,24 +822,23 @@ void tst_QFileSystemModel::sort()
myModel->setRootPath("");
myModel->setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
- tree->setSortingEnabled(true);
- tree->setModel(myModel);
- tree->show();
- tree->resize(800, 800);
- QVERIFY(QTest::qWaitForWindowActive(tree));
- tree->header()->setSortIndicator(1,Qt::DescendingOrder);
- tree->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
+ tree.setSortingEnabled(true);
+ tree.setModel(myModel.data());
+ tree.show();
+ tree.resize(800, 800);
+ QVERIFY(QTest::qWaitForWindowActive(&tree));
+ tree.header()->setSortIndicator(1, Qt::DescendingOrder);
+ tree.header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
QStringList dirsToOpen;
- do
- {
- dirsToOpen<<dir.absolutePath();
+ do {
+ dirsToOpen << dir.absolutePath();
} while (dir.cdUp());
for (int i = dirsToOpen.size() -1 ; i > 0 ; --i) {
QString path = dirsToOpen[i];
- tree->expand(myModel->index(path, 0));
+ tree.expand(myModel->index(path, 0));
}
- tree->expand(myModel->index(dirPath, 0));
+ tree.expand(myModel->index(dirPath, 0));
QModelIndex parent = myModel->index(dirPath, 0);
QList<QString> expectedOrder;
expectedOrder << tempFile2.fileName() << tempFile.fileName() << dirPath + QChar('/') + ".." << dirPath + QChar('/') + ".";
@@ -859,15 +864,13 @@ void tst_QFileSystemModel::sort()
QTRY_COMPARE(dirPath + QChar('/') + myModel->index(i, 1, parent).data(QFileSystemModel::FileNameRole).toString(), expectedOrder.at(i));
}
}
-
- delete tree;
- delete myModel;
}
void tst_QFileSystemModel::mkdir()
{
QString tmp = flatDirTestPath;
QString newFolderPath = QDir::toNativeSeparators(tmp + '/' + "NewFoldermkdirtest4");
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
QModelIndex tmpDir = model->index(tmp);
QVERIFY(tmpDir.isValid());
QDir bestatic(newFolderPath);
@@ -902,6 +905,7 @@ void tst_QFileSystemModel::deleteFile()
qWarning() << "unable to create" << newFilePath;
}
newFile.close();
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
QModelIndex idx = model->index(newFilePath);
QVERIFY(idx.isValid());
QVERIFY(model->remove(idx));
@@ -963,7 +967,8 @@ void tst_QFileSystemModel::caseSensitivity()
QString tmp = flatDirTestPath;
QStringList files;
files << "a" << "c" << "C";
- QVERIFY(createFiles(tmp, files));
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QVERIFY(createFiles(model.data(), tmp, files));
QModelIndex root = model->index(tmp);
QStringList paths;
QModelIndexList indexes;
@@ -1013,13 +1018,14 @@ void tst_QFileSystemModel::dirsBeforeFiles()
const int itemCount = 3;
for (int i = 0; i < itemCount; ++i) {
- QLatin1Char c('a' + i);
- dir.mkdir(c + QLatin1String("-dir"));
+ QLatin1Char c('a' + char(i));
+ QVERIFY(dir.mkdir(c + QLatin1String("-dir")));
QFile file(flatDirTestPath + QLatin1Char('/') + c + QLatin1String("-file"));
- file.open(QIODevice::ReadWrite);
+ QVERIFY(file.open(QIODevice::ReadWrite));
file.close();
}
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
QModelIndex root = model->setRootPath(flatDirTestPath);
// Wait for model to be notified by the file system watcher
QTRY_COMPARE(model->rowCount(root), 2 * itemCount);
@@ -1073,7 +1079,7 @@ static inline QByteArray permissionRowName(bool readOnly, int permission)
void tst_QFileSystemModel::permissions_data()
{
- QTest::addColumn<int>("permissions");
+ QTest::addColumn<QFileDevice::Permissions>("permissions");
QTest::addColumn<bool>("readOnly");
static const int permissions[] = {
@@ -1081,22 +1087,23 @@ void tst_QFileSystemModel::permissions_data()
QFile::ReadOwner,
QFile::WriteOwner|QFile::ReadOwner,
};
- for (size_t i = 0; i < sizeof permissions / sizeof *permissions; ++i) {
- QTest::newRow(permissionRowName(false, permissions[i]).constData()) << permissions[i] << false;
- QTest::newRow(permissionRowName(true, permissions[i]).constData()) << permissions[i] << true;
+ for (int permission : permissions) {
+ QTest::newRow(permissionRowName(false, permission).constData()) << QFileDevice::Permissions(permission) << false;
+ QTest::newRow(permissionRowName(true, permission).constData()) << QFileDevice::Permissions(permission) << true;
}
}
void tst_QFileSystemModel::permissions() // checks QTBUG-20503
{
- QFETCH(int, permissions);
+ QFETCH(QFileDevice::Permissions, permissions);
QFETCH(bool, readOnly);
const QString tmp = flatDirTestPath;
const QString file = tmp + QLatin1String("/f");
- QVERIFY(createFiles(tmp, QStringList() << "f"));
+ QScopedPointer<QFileSystemModel> model(new QFileSystemModel);
+ QVERIFY(createFiles(model.data(), tmp, QStringList{QLatin1String("f")}));
- QVERIFY(QFile::setPermissions(file, QFile::Permissions(permissions)));
+ QVERIFY(QFile::setPermissions(file, permissions));
const QModelIndex root = model->setRootPath(tmp);
diff --git a/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
index da52809aad..e633e7c0a3 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
@@ -1,2 +1,6 @@
[defaultButton]
-*
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+ubuntu-18.04
+rhel-7.4
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST
index 1789f51507..2b784414cd 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST
@@ -1,2 +1,2 @@
[autoShow]
-osx ci
+osx-10.13
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 2ada4fedb6..6f527e7b6b 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
@@ -252,7 +252,7 @@ class QTestTranslator : public QTranslator
{
const QString m_str;
public:
- explicit QTestTranslator(QString str) : m_str(qMove(str)) {}
+ explicit QTestTranslator(QString str) : m_str(std::move(str)) {}
QString translate(const char *, const char *sourceText, const char *, int) const override
{ return m_str + sourceText + m_str; }
@@ -265,7 +265,7 @@ class QTranslatorGuard {
Translator t;
public:
template <typename Arg>
- explicit QTranslatorGuard(Arg a) : t(qMove(a))
+ explicit QTranslatorGuard(Arg a) : t(std::move(a))
{ qApp->installTranslator(&t); }
~QTranslatorGuard()
{ qApp->removeTranslator(&t); }
diff --git a/tests/auto/widgets/effects/qgraphicseffect/BLACKLIST b/tests/auto/widgets/effects/qgraphicseffect/BLACKLIST
index 4833af527f..64a92d18aa 100644
--- a/tests/auto/widgets/effects/qgraphicseffect/BLACKLIST
+++ b/tests/auto/widgets/effects/qgraphicseffect/BLACKLIST
@@ -1,3 +1,2 @@
[prepareGeometryChangeInvalidateCache]
-opensuse
-opensuse-leap
+opensuse-42.3
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
index ae6de48195..16818a98f9 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
@@ -5,4 +5,4 @@ QT += core-private gui-private
SOURCES += tst_qgraphicsitem.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-win32:!winrt: LIBS += -luser32
+win32:!winrt: QMAKE_USE += user32
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 670dc0b808..7b914512ab 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -4441,12 +4441,14 @@ protected:
case QGraphicsItem::ItemPositionHasChanged:
break;
case QGraphicsItem::ItemMatrixChange: {
+#if QT_DEPRECATED_SINCE(5, 13)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
QVariant variant;
variant.setValue<QMatrix>(matrix());
oldValues << variant;
QT_WARNING_POP
+#endif
}
break;
case QGraphicsItem::ItemTransformChange: {
@@ -4566,6 +4568,7 @@ void tst_QGraphicsItem::itemChange()
QCOMPARE(tester.oldValues.last(), QVariant(true));
QCOMPARE(tester.isEnabled(), true);
}
+#if QT_DEPRECATED_SINCE(5, 13)
{
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED // QDesktopWidget::screen()
@@ -4585,6 +4588,7 @@ QT_WARNING_DISABLE_DEPRECATED // QDesktopWidget::screen()
QCOMPARE(tester.matrix(), QMatrix().rotate(90));
QT_WARNING_POP
}
+#endif
{
tester.resetTransform();
++changeCount;
@@ -8397,7 +8401,7 @@ void tst_QGraphicsItem::focusProxy()
QString err;
QTextStream stream(&err);
stream << "QGraphicsItem::setFocusProxy: "
- << (void*)item << " is already in the focus proxy chain" << flush;
+ << (void*)item << " is already in the focus proxy chain" << Qt::flush;
QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData());
item2->setFocusProxy(item); // fails
QCOMPARE(item->focusProxy(), (QGraphicsItem *)item2);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp
index dfb2752ee0..ed79904ed8 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp
@@ -54,9 +54,9 @@ void tst_QGraphicsItemAnimation::construction()
QCOMPARE(animation.posAt(0), QPointF());
QCOMPARE(animation.posAt(0.5), QPointF());
QCOMPARE(animation.posAt(1), QPointF());
- QCOMPARE(animation.matrixAt(0), QMatrix());
- QCOMPARE(animation.matrixAt(0.5), QMatrix());
- QCOMPARE(animation.matrixAt(1), QMatrix());
+ QCOMPARE(animation.transformAt(0), QTransform());
+ QCOMPARE(animation.transformAt(0.5), QTransform());
+ QCOMPARE(animation.transformAt(1), QTransform());
QCOMPARE(animation.rotationAt(0), qreal(0.0));
QCOMPARE(animation.rotationAt(0.5), qreal(0.0));
QCOMPARE(animation.rotationAt(1), qreal(0.0));
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 4a301337ef..39aa65a478 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -330,7 +330,7 @@ public:
{
// Make sure QGraphicsProxyWidget::paint does not modify the render hints set on the painter.
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform
- | QPainter::NonCosmeticDefaultPen | QPainter::TextAntialiasing);
+ | QPainter::TextAntialiasing);
const QPainter::RenderHints oldRenderHints = painter->renderHints();
QGraphicsProxyWidget::paint(painter, option, widget);
QCOMPARE(painter->renderHints(), oldRenderHints);
@@ -463,14 +463,13 @@ void tst_QGraphicsProxyWidget::setWidget()
QCOMPARE(proxy->focusPolicy(), Qt::WheelFocus);
QVERIFY(proxy->acceptDrops());
QCOMPARE(proxy->acceptHoverEvents(), true); // to get widget enter events
- int left, top, right, bottom;
- widget->getContentsMargins(&left, &top, &right, &bottom);
+ const QMarginsF margins = QMarginsF{widget->contentsMargins()};
qreal rleft, rtop, rright, rbottom;
proxy->getContentsMargins(&rleft, &rtop, &rright, &rbottom);
- QCOMPARE((qreal)left, rleft);
- QCOMPARE((qreal)top, rtop);
- QCOMPARE((qreal)right, rright);
- QCOMPARE((qreal)bottom, rbottom);
+ QCOMPARE(margins.left(), rleft);
+ QCOMPARE(margins.top(), rtop);
+ QCOMPARE(margins.right(), rright);
+ QCOMPARE(margins.bottom(), rbottom);
} else {
// proxy shouldn't mess with the widget if it can't insert it.
QCOMPARE(proxy->widget(), nullptr);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
index b8b427b3dd..a3c9e2e421 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/BLACKLIST
@@ -3,11 +3,5 @@ opensuse-42.3 ci
[removeFullyTransparentItem]
osx-10.12
[tabFocus_sceneWithNestedFocusWidgets]
-opensuse
-opensuse-leap
-[inputMethod]
-opensuse
-opensuse-leap
-[hoverEvents_parentChild]
-ubuntu
+opensuse-42.3
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
index 351cecd92e..2f648a2212 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
@@ -4,7 +4,7 @@ QT += widgets widgets-private testlib
QT += core-private gui-private
SOURCES += tst_qgraphicsscene.cpp
RESOURCES += images.qrc
-win32:!winrt: LIBS += -luser32
+win32:!winrt: QMAKE_USE += user32
DEFINES += SRCDIR=\\\"$$PWD\\\"
DEFINES += QT_NO_CAST_TO_ASCII
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
index ee13a37212..22fce8620b 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
@@ -1,20 +1,24 @@
[task255529_transformationAnchorMouseAndViewportMargins]
-xcb
+opensuse-leap
+rhel-7.4
+ubuntu-16.04
+opensuse-42.3
[cursor]
-xcb
+opensuse-leap
+ubuntu-16.04
+opensuse-42.3
[cursor2]
-xcb
-windows
-[rubberBandExtendSelection]
-xcb
-[rotated_rubberBand]
-xcb
+ubuntu-16.04
[sendEvent]
-xcb
-[forwardMousePress]
-xcb
+ubuntu-16.04
+opensuse-42.3
[resizeAnchor]
-xcb
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+ubuntu-18.04
+rhel-7.4
+opensuse-42.3
[update2]
opensuse-42.3
[itemsInRect_cosmeticAdjust]
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 1442219bea..5ac3834aef 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -352,8 +352,8 @@ void tst_QGraphicsView::renderHints()
view.setScene(&scene);
- view.setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
- QCOMPARE(view.renderHints(), QPainter::TextAntialiasing | QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
+ view.setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing);
+ QCOMPARE(view.renderHints(), QPainter::TextAntialiasing | QPainter::Antialiasing);
QCOMPARE(item->hints, 0);
view.show();
@@ -361,8 +361,8 @@ void tst_QGraphicsView::renderHints()
view.repaint();
QTRY_COMPARE(item->hints, view.renderHints());
- view.setRenderHints(QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
- QCOMPARE(view.renderHints(), QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
+ view.setRenderHints(QPainter::Antialiasing);
+ QCOMPARE(view.renderHints(), QPainter::Antialiasing);
view.repaint();
QTRY_COMPARE(item->hints, view.renderHints());
@@ -2219,7 +2219,7 @@ void tst_QGraphicsView::wheelEvent()
{
QWheelEvent event(view.mapFromScene(widget->boundingRect().center()),
view.mapToGlobal(view.mapFromScene(widget->boundingRect().center())),
- 120, 0, 0, Qt::Horizontal);
+ QPoint(), QPoint(120, 0), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QApplication::sendEvent(view.viewport(), &event);
QCOMPARE(scene.orientation, Qt::Horizontal);
}
@@ -2228,7 +2228,7 @@ void tst_QGraphicsView::wheelEvent()
{
QWheelEvent event(view.mapFromScene(widget->boundingRect().center()),
view.mapToGlobal(view.mapFromScene(widget->boundingRect().center())),
- 120, 0, 0, Qt::Vertical);
+ QPoint(), QPoint(0, 120), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QApplication::sendEvent(view.viewport(), &event);
QCOMPARE(scene.orientation, Qt::Vertical);
}
@@ -2526,9 +2526,8 @@ void tst_QGraphicsView::viewportUpdateMode2()
view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
view.setScene(&dummyScene);
view.ensurePolished(); // make sure we get the right content margins
- int left, top, right, bottom;
- view.getContentsMargins(&left, &top, &right, &bottom);
- view.resize(200 + left + right, 200 + top + bottom);
+ const QMargins margins = view.contentsMargins();
+ view.resize(200 + margins.left() + margins.right(), 200 + margins.top() + margins.bottom());
toplevel.show();
qApp->setActiveWindow(&toplevel);
QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
@@ -4043,9 +4042,8 @@ void tst_QGraphicsView::update()
CustomView view(0, &toplevel);
view.setScene(&dummyScene);
view.ensurePolished(); // must ensure polished to get content margins right
- int left, top, right, bottom;
- view.getContentsMargins(&left, &top, &right, &bottom);
- view.resize(200 + left + right, 200 + top + bottom);
+ const QMargins margins = view.contentsMargins();
+ view.resize(200 + margins.left() + margins.right(), 200 + margins.top() + margins.bottom());
toplevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&toplevel));
@@ -4857,7 +4855,7 @@ void tst_QGraphicsView::QTBUG_16063_microFocusRect()
scene.setFocusItem(item);
view.setFocus();
- QRectF mfv = view.inputMethodQuery(Qt::ImMicroFocus).toRectF();
+ QRectF mfv = view.inputMethodQuery(Qt::ImCursorRectangle).toRectF();
QCOMPARE(mfv, IMItem::mf.translated(-view.mapToScene(view.sceneRect().toRect()).boundingRect().topLeft()));
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 85b42e54fe..d3477be986 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -2905,7 +2905,7 @@ public:
Q_UNUSED(widget);
qreal w = rect().width();
QRectF box(0, 0, w, 2400/w);
- painter->drawRoundRect(box);
+ painter->drawRoundedRect(box, 25, 25, Qt::RelativeSize);
painter->drawLine(box.topLeft(), box.bottomRight());
painter->drawLine(box.bottomLeft(), box.topRight());
}
diff --git a/tests/auto/widgets/itemviews/qcolumnview/BLACKLIST b/tests/auto/widgets/itemviews/qcolumnview/BLACKLIST
deleted file mode 100644
index bda01c700c..0000000000
--- a/tests/auto/widgets/itemviews/qcolumnview/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[scrollTo:reverse]
-osx
diff --git a/tests/auto/widgets/itemviews/qheaderview/BLACKLIST b/tests/auto/widgets/itemviews/qheaderview/BLACKLIST
index efb813f7d2..297a6fe7b7 100644
--- a/tests/auto/widgets/itemviews/qheaderview/BLACKLIST
+++ b/tests/auto/widgets/itemviews/qheaderview/BLACKLIST
@@ -1,3 +1,3 @@
[stretchAndRestoreLastSection]
-opensuse
opensuse-leap
+opensuse-42.3
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 1b3e1e1f34..f247889d55 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -85,8 +85,8 @@ class XResetModel : public QStandardItemModel
blockSignals(true);
bool r = QStandardItemModel::removeRows(row, count, parent);
blockSignals(false);
- emit beginResetModel();
- emit endResetModel();
+ beginResetModel();
+ endResetModel();
return r;
}
virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex())
@@ -94,8 +94,8 @@ class XResetModel : public QStandardItemModel
blockSignals(true);
bool r = QStandardItemModel::insertRows(row, count, parent);
blockSignals(false);
- emit beginResetModel();
- emit endResetModel();
+ beginResetModel();
+ endResetModel();
return r;
}
};
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro
index 10cd1dcc54..916694fd0f 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro
+++ b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro
@@ -3,4 +3,4 @@ TARGET = tst_qitemdelegate
QT += widgets widgets-private testlib
SOURCES += tst_qitemdelegate.cpp
-win32:!winrt: LIBS += -luser32
+win32:!winrt: QMAKE_USE += user32
diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro
index 75f45ab432..c3e19adc81 100644
--- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro
+++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro
@@ -2,4 +2,4 @@ CONFIG += testcase
TARGET = tst_qlistview
QT += widgets gui-private widgets-private core-private testlib testlib-private
SOURCES += tst_qlistview.cpp
-win32:!winrt: LIBS += -luser32
+win32:!winrt: QMAKE_USE += user32
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 0b828b8484..3a60b3b7c6 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -2516,9 +2516,9 @@ void tst_QListView::horizontalScrollingByVerticalWheelEvents()
QPoint globalPos = lv.geometry().center();
QPoint pos = lv.viewport()->geometry().center();
- QWheelEvent wheelDownEvent(pos, globalPos, QPoint(0, 0), QPoint(0, -120), -120, Qt::Vertical, 0, 0);
- QWheelEvent wheelUpEvent(pos, globalPos, QPoint(0, 0), QPoint(0, 120), 120, Qt::Vertical, 0, 0);
- QWheelEvent wheelLeftDownEvent(pos, globalPos, QPoint(0, 0), QPoint(120, -120), -120, Qt::Vertical, 0, 0);
+ QWheelEvent wheelDownEvent(pos, globalPos, QPoint(0, 0), QPoint(0, -120), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
+ QWheelEvent wheelUpEvent(pos, globalPos, QPoint(0, 0), QPoint(0, 120), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
+ QWheelEvent wheelLeftDownEvent(pos, globalPos, QPoint(0, 0), QPoint(120, -120), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
int hValue = lv.horizontalScrollBar()->value();
QApplication::sendEvent(lv.viewport(), &wheelDownEvent);
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index 91088aeeca..fe2ede4183 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
@@ -1525,11 +1525,11 @@ void tst_QListWidget::itemData()
item.setData(Qt::DisplayRole, QString("0"));
QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole}));
item.setData(Qt::CheckStateRole, Qt::PartiallyChecked);
- QCOMPARE(widget.currentRoles, {Qt::CheckStateRole});
+ QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole});
for (int i = 0; i < 4; ++i)
{
item.setData(Qt::UserRole + i, QString::number(i + 1));
- QCOMPARE(widget.currentRoles, {Qt::UserRole + i});
+ QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i});
}
QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0));
QCOMPARE(flags.count(), 6);
diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
index be90475a6f..9648cef3de 100644
--- a/tests/auto/widgets/itemviews/qtableview/BLACKLIST
+++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
@@ -1,4 +1,3 @@
[moveCursorBiggerJump]
osx
-[columnViewportPosition]
-winrt # QTBUG-72853
+
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index b1ddc6e7a2..6bbb30a6db 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -32,6 +32,9 @@
#include <private/qtablewidget_p.h>
#include <QtTest/QtTest>
#include "private/qapplication_p.h"
+#if QT_CONFIG(textmarkdownwriter)
+#include "private/qtextmarkdownwriter_p.h"
+#endif
#include <algorithm>
@@ -196,6 +199,10 @@ private slots:
void viewOptions();
void taskQTBUG_7232_AllowUserToControlSingleStep();
+
+#if QT_CONFIG(textmarkdownwriter)
+ void markdownWriter();
+#endif
};
// Testing get/set functions
@@ -4067,8 +4074,10 @@ void tst_QTableView::mouseWheel()
view.verticalScrollBar()->setValue(10);
QPoint pos = view.viewport()->geometry().center();
- QWheelEvent verticalEvent(pos, delta, 0, 0, Qt::Vertical);
- QWheelEvent horizontalEvent(pos, delta, 0, 0, Qt::Horizontal);
+ QWheelEvent verticalEvent(pos, view.mapToGlobal(pos), QPoint(), QPoint(0, delta),
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
+ QWheelEvent horizontalEvent(pos, view.mapToGlobal(pos), QPoint(), QPoint(delta, 0),
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QApplication::sendEvent(view.viewport(), &horizontalEvent);
QVERIFY(qAbs(view.horizontalScrollBar()->value() - horizontalPositon) < 15);
QApplication::sendEvent(view.viewport(), &verticalEvent);
@@ -4343,7 +4352,9 @@ void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
int sbValueBefore = view.verticalScrollBar()->value();
QHeaderView *header = view.verticalHeader();
QTest::mouseMove(header);
- QWheelEvent wheelEvent(header->geometry().center(), -720, 0, 0);
+ QPoint pos = header->geometry().center();
+ QWheelEvent wheelEvent(pos, header->viewport()->mapToGlobal(pos), QPoint(), QPoint(0, -720),
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QApplication::sendEvent(header->viewport(), &wheelEvent);
int sbValueAfter = view.verticalScrollBar()->value();
QVERIFY(sbValueBefore != sbValueAfter);
@@ -4560,5 +4571,33 @@ void tst_QTableView::taskQTBUG_50171_selectRowAfterSwapColumns()
}
}
+// This has nothing to do with QTableView, but it's convenient to reuse the QtTestTableModel
+#if QT_CONFIG(textmarkdownwriter)
+
+// #define DEBUG_WRITE_OUTPUT
+
+void tst_QTableView::markdownWriter()
+{
+ QtTestTableModel model(2, 3);
+ QString md;
+ {
+ QTextStream stream(&md);
+ QTextMarkdownWriter writer(stream, QTextDocument::MarkdownDialectGitHub);
+ writer.writeTable(&model);
+ }
+
+#ifdef DEBUG_WRITE_OUTPUT
+ {
+ QFile out("/tmp/table.md");
+ out.open(QFile::WriteOnly);
+ out.write(md.toUtf8());
+ out.close();
+ }
+#endif
+
+ QCOMPARE(md, QString::fromLatin1("|1 |2 |3 |\n|-------|-------|-------|\n|[0,0,0]|[0,1,0]|[0,2,0]|\n|[1,0,0]|[1,1,0]|[1,2,0]|\n"));
+}
+#endif
+
QTEST_MAIN(tst_QTableView)
#include "tst_qtableview.moc"
diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
index c2de5c2761..6184962d93 100644
--- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
@@ -1383,11 +1383,11 @@ void tst_QTableWidget::itemData()
item->setData(Qt::DisplayRole, QString("0"));
QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole}));
item->setData(Qt::CheckStateRole, Qt::PartiallyChecked);
- QCOMPARE(widget.currentRoles, {Qt::CheckStateRole});
+ QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole});
for (int i = 0; i < 4; ++i)
{
item->setData(Qt::UserRole + i, QString::number(i + 1));
- QCOMPARE(widget.currentRoles, {Qt::UserRole + i});
+ QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i});
}
QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0));
QCOMPARE(flags.count(), 6);
diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
index 33d4f3bf91..0d97974b90 100644
--- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
@@ -1999,10 +1999,10 @@ void tst_QTreeWidget::itemData()
item.setData(0, Qt::DisplayRole, QString("0"));
QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole}));
item.setData(0, Qt::CheckStateRole, Qt::PartiallyChecked);
- QCOMPARE(widget.currentRoles, {Qt::CheckStateRole});
+ QCOMPARE(widget.currentRoles, QVector<int>{Qt::CheckStateRole});
for (int i = 0; i < 4; ++i) {
item.setData(0, Qt::UserRole + i, QString::number(i + 1));
- QCOMPARE(widget.currentRoles, {Qt::UserRole + i});
+ QCOMPARE(widget.currentRoles, QVector<int>{Qt::UserRole + i});
}
QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0));
QCOMPARE(flags.count(), 6);
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro
index 73fd934502..af85a2bd13 100644
--- a/tests/auto/widgets/kernel/kernel.pro
+++ b/tests/auto/widgets/kernel/kernel.pro
@@ -22,5 +22,3 @@ SUBDIRS=\
darwin:SUBDIRS -= \ # Uses native recognizers
qgesturerecognizer \
-
-SUBDIRS -= qsound
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 3d68e42baf..0d62c2cd4b 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -70,7 +70,7 @@ private slots:
void shortcutFromKeyEvent(); // QTBUG-48325
private:
- int m_lastEventType;
+ QEvent::Type m_lastEventType;
const int m_keyboardScheme;
QAction *m_lastAction;
};
@@ -82,7 +82,7 @@ tst_QAction::tst_QAction()
void tst_QAction::init()
{
- m_lastEventType = 0;
+ m_lastEventType = QEvent::None;
m_lastAction = nullptr;
}
@@ -94,23 +94,23 @@ void tst_QAction::cleanup()
// Testing get/set functions
void tst_QAction::getSetCheck()
{
- QAction obj1(0);
+ QAction obj1(nullptr);
// QActionGroup * QAction::actionGroup()
// void QAction::setActionGroup(QActionGroup *)
- QActionGroup *var1 = new QActionGroup(0);
+ QActionGroup *var1 = new QActionGroup(nullptr);
obj1.setActionGroup(var1);
QCOMPARE(var1, obj1.actionGroup());
- obj1.setActionGroup((QActionGroup *)0);
- QCOMPARE((QActionGroup *)0, obj1.actionGroup());
+ obj1.setActionGroup(nullptr);
+ QCOMPARE(obj1.actionGroup(), nullptr);
delete var1;
// QMenu * QAction::menu()
// void QAction::setMenu(QMenu *)
- QMenu *var2 = new QMenu(0);
+ QMenu *var2 = new QMenu(nullptr);
obj1.setMenu(var2);
QCOMPARE(var2, obj1.menu());
- obj1.setMenu((QMenu *)0);
- QCOMPARE((QMenu *)0, obj1.menu());
+ obj1.setMenu(nullptr);
+ QCOMPARE(obj1.menu(), nullptr);
delete var2;
QCOMPARE(obj1.priority(), QAction::NormalPriority);
@@ -148,7 +148,7 @@ void tst_QAction::setText()
{
QFETCH(QString, text);
- QAction action(0);
+ QAction action(nullptr);
action.setText(text);
QCOMPARE(action.text(), text);
@@ -161,7 +161,7 @@ void tst_QAction::setIconText()
{
QFETCH(QString, iconText);
- QAction action(0);
+ QAction action(nullptr);
action.setIconText(iconText);
QCOMPARE(action.iconText(), iconText);
@@ -171,7 +171,7 @@ void tst_QAction::setIconText()
void tst_QAction::setUnknownFont() // QTBUG-42728
{
- QAction action(0);
+ QAction action(nullptr);
QFont font("DoesNotExist", 11);
action.setFont(font);
@@ -182,17 +182,17 @@ void tst_QAction::setUnknownFont() // QTBUG-42728
void tst_QAction::updateState(QActionEvent *e)
{
if (!e) {
- m_lastEventType = 0;
- m_lastAction = 0;
+ m_lastEventType = QEvent::None;
+ m_lastAction = nullptr;
} else {
- m_lastEventType = (int)e->type();
+ m_lastEventType = e->type();
m_lastAction = e->action();
}
}
void tst_QAction::actionEvent()
{
- QAction a(0);
+ QAction a(nullptr);
a.setText("action text");
// add action
@@ -202,33 +202,33 @@ void tst_QAction::actionEvent()
testWidget.addAction(&a);
qApp->processEvents();
- QCOMPARE(m_lastEventType, (int)QEvent::ActionAdded);
+ QCOMPARE(m_lastEventType, QEvent::ActionAdded);
QCOMPARE(m_lastAction, &a);
// change action
a.setText("new action text");
qApp->processEvents();
- QCOMPARE(m_lastEventType, (int)QEvent::ActionChanged);
+ QCOMPARE(m_lastEventType, QEvent::ActionChanged);
QCOMPARE(m_lastAction, &a);
// remove action
testWidget.removeAction(&a);
qApp->processEvents();
- QCOMPARE(m_lastEventType, (int)QEvent::ActionRemoved);
+ QCOMPARE(m_lastEventType, QEvent::ActionRemoved);
QCOMPARE(m_lastAction, &a);
}
//basic testing of standard keys
void tst_QAction::setStandardKeys()
{
- QAction act(0);
+ QAction act(nullptr);
act.setShortcut(QKeySequence("CTRL+L"));
QList<QKeySequence> list;
act.setShortcuts(list);
act.setShortcuts(QKeySequence::Copy);
- QCOMPARE(act.shortcut(), act.shortcuts().first());
+ QCOMPARE(act.shortcut(), act.shortcuts().constFirst());
QList<QKeySequence> expected;
const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C"));
@@ -263,7 +263,7 @@ void tst_QAction::alternateShortcuts()
QList<QKeySequence> shlist = QList<QKeySequence>() << QKeySequence("CTRL+P") << QKeySequence("CTRL+A");
act.setShortcuts(shlist);
- QSignalSpy spy(&act, SIGNAL(triggered()));
+ QSignalSpy spy(&act, &QAction::triggered);
act.setAutoRepeat(true);
QTest::keyClick(&testWidget, Qt::Key_A, Qt::ControlModifier);
@@ -322,7 +322,7 @@ void tst_QAction::enabledVisibleInteraction()
testWidget.show();
QApplication::setActiveWindow(&testWidget);
- QAction act(0);
+ QAction act(nullptr);
// check defaults
QVERIFY(act.isEnabled());
QVERIFY(act.isVisible());
@@ -370,7 +370,7 @@ void tst_QAction::task229128TriggeredSignalWithoutActiongroup()
{
// test without a group
const QScopedPointer<QAction> actionWithoutGroup(new QAction("Test", nullptr));
- QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), SIGNAL(triggered(bool)));
+ QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), QOverload<bool>::of(&QAction::triggered));
QCOMPARE(spyWithoutGroup.count(), 0);
actionWithoutGroup->trigger();
// signal should be emitted
@@ -388,7 +388,7 @@ void tst_QAction::task229128TriggeredSignalWithoutActiongroup()
void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
{
- QActionGroup ag(0);
+ QActionGroup ag(nullptr);
QAction *action = new QAction("Test", &ag);
QAction *checkedAction = new QAction("Test 2", &ag);
ag.addAction(action);
@@ -397,8 +397,8 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
checkedAction->setCheckable(true);
checkedAction->setChecked(true);
- QSignalSpy actionSpy(checkedAction, SIGNAL(triggered(bool)));
- QSignalSpy actionGroupSpy(&ag, SIGNAL(triggered(QAction*)));
+ QSignalSpy actionSpy(checkedAction, QOverload<bool>::of(&QAction::triggered));
+ QSignalSpy actionGroupSpy(&ag, QOverload<QAction*>::of(&QActionGroup::triggered));
QCOMPARE(actionGroupSpy.count(), 0);
QCOMPARE(actionSpy.count(), 0);
checkedAction->trigger();
@@ -513,10 +513,10 @@ void tst_QAction::disableShortcutsWithBlockedWidgets()
class ShortcutOverrideWidget : public QWidget
{
public:
- ShortcutOverrideWidget(QWidget *parent = 0) : QWidget(parent), shortcutOverrideCount(0) {}
- int shortcutOverrideCount;
+ using QWidget::QWidget;
+ int shortcutOverrideCount = 0;
protected:
- bool event(QEvent *e)
+ bool event(QEvent *e) override
{
if (e->type() == QEvent::ShortcutOverride)
++shortcutOverrideCount;
diff --git a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
index 52ca10d31f..524040d003 100644
--- a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
+++ b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp
@@ -41,6 +41,7 @@ private slots:
void enabledPropagation();
void visiblePropagation();
void exclusive();
+ void exclusiveOptional();
void separators();
void testActionInTwoQActionGroup();
void unCheckCurrentAction();
@@ -48,11 +49,11 @@ private slots:
void tst_QActionGroup::enabledPropagation()
{
- QActionGroup testActionGroup( 0 );
+ QActionGroup testActionGroup(nullptr);
QAction* childAction = new QAction( &testActionGroup );
QAction* anotherChildAction = new QAction( &testActionGroup );
- QAction* freeAction = new QAction(0);
+ QAction* freeAction = new QAction(nullptr);
QVERIFY( testActionGroup.isEnabled() );
QVERIFY( childAction->isEnabled() );
@@ -87,11 +88,11 @@ void tst_QActionGroup::enabledPropagation()
void tst_QActionGroup::visiblePropagation()
{
- QActionGroup testActionGroup( 0 );
+ QActionGroup testActionGroup(nullptr);
QAction* childAction = new QAction( &testActionGroup );
QAction* anotherChildAction = new QAction( &testActionGroup );
- QAction* freeAction = new QAction(0);
+ QAction* freeAction = new QAction(nullptr);
QVERIFY( testActionGroup.isVisible() );
QVERIFY( childAction->isVisible() );
@@ -124,7 +125,7 @@ void tst_QActionGroup::visiblePropagation()
void tst_QActionGroup::exclusive()
{
- QActionGroup group(0);
+ QActionGroup group(nullptr);
group.setExclusive(false);
QVERIFY( !group.isExclusive() );
@@ -151,6 +152,52 @@ void tst_QActionGroup::exclusive()
QVERIFY( !actThree->isChecked() );
}
+void tst_QActionGroup::exclusiveOptional()
+{
+ QActionGroup group(0);
+ group.setExclusive(true);
+ QVERIFY( group.isExclusive() );
+
+ QAction* actOne = new QAction( &group );
+ actOne->setCheckable( true );
+ QAction* actTwo = new QAction( &group );
+ actTwo->setCheckable( true );
+ QAction* actThree = new QAction( &group );
+ actThree->setCheckable( true );
+
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->trigger();
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actOne->trigger();
+ QVERIFY( actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ group.setExclusionPolicy( QActionGroup::ExclusionPolicy::ExclusiveOptional );
+ QVERIFY( group.isExclusive() );
+
+ actOne->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+
+ actTwo->trigger();
+ QVERIFY( !actOne->isChecked() );
+ QVERIFY( !actTwo->isChecked() );
+ QVERIFY( !actThree->isChecked() );
+}
+
void tst_QActionGroup::separators()
{
QMainWindow mw;
@@ -166,26 +213,24 @@ void tst_QActionGroup::separators()
separator->setSeparator(true);
actGroup.addAction(separator);
- QListIterator<QAction*> it(actGroup.actions());
- while (it.hasNext())
- menu.addAction(it.next());
+ menu.addActions(actGroup.actions());
- QCOMPARE((int)menu.actions().size(), 2);
+ QCOMPARE(menu.actions().size(), 2);
- it = QListIterator<QAction*>(actGroup.actions());
- while (it.hasNext())
- menu.removeAction(it.next());
+ const auto removeActions = [&menu](const QList<QAction *> &actions) {
+ for (QAction *action : actions)
+ menu.removeAction(action);
+ };
+ removeActions(actGroup.actions());
- QCOMPARE((int)menu.actions().size(), 0);
+ QCOMPARE(menu.actions().size(), 0);
action = new QAction(&actGroup);
action->setText("test two");
- it = QListIterator<QAction*>(actGroup.actions());
- while (it.hasNext())
- menu.addAction(it.next());
+ menu.addActions(actGroup.actions());
- QCOMPARE((int)menu.actions().size(), 3);
+ QCOMPARE(menu.actions().size(), 3);
}
void tst_QActionGroup::testActionInTwoQActionGroup()
@@ -205,7 +250,7 @@ void tst_QActionGroup::testActionInTwoQActionGroup()
void tst_QActionGroup::unCheckCurrentAction()
{
- QActionGroup group(0);
+ QActionGroup group(nullptr);
QAction action1(&group) ,action2(&group);
action1.setCheckable(true);
action2.setCheckable(true);
diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST
index d7de7bf16e..ac65a97c40 100644
--- a/tests/auto/widgets/kernel/qapplication/BLACKLIST
+++ b/tests/auto/widgets/kernel/qapplication/BLACKLIST
@@ -1,4 +1,4 @@
[touchEventPropagation]
-# QTBUG-66745
-opensuse
opensuse-leap
+# QTBUG-66745
+opensuse-42.3
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 7ee085b81c..367a5767c4 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -890,7 +890,9 @@ void tst_QApplication::libraryPaths()
QStringList actual = QApplication::libraryPaths();
actual.sort();
- QStringList expected = QSet<QString>::fromList((QStringList() << testDir << appDirPath)).toList();
+ QStringList expected;
+ expected << testDir << appDirPath;
+ expected = QSet<QString>(expected.constBegin(), expected.constEnd()).values();
expected.sort();
QVERIFY2(isPathListIncluded(actual, expected),
@@ -907,7 +909,9 @@ void tst_QApplication::libraryPaths()
QStringList actual = QApplication::libraryPaths();
actual.sort();
- QStringList expected = QSet<QString>::fromList((QStringList() << installPathPlugins << appDirPath)).toList();
+ QStringList expected;
+ expected << installPathPlugins << appDirPath;
+ expected = QSet<QString>(expected.constBegin(), expected.constEnd()).values();
expected.sort();
#ifdef Q_OS_WINRT
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index b2650d1f32..00bde3cb25 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -47,6 +47,7 @@ private slots:
void sizeConstraints();
void setGeometry();
void setStyleShouldChangeSpacing();
+ void widgetSurplus();
void testLayoutEngine_data();
void testLayoutEngine();
@@ -193,7 +194,7 @@ void tst_QBoxLayout::setGeometry()
setFrameless(&toplevel);
QWidget w(&toplevel);
QVBoxLayout *lay = new QVBoxLayout;
- lay->setMargin(0);
+ lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(0);
QHBoxLayout *lay2 = new QHBoxLayout;
QDial *dial = new QDial;
@@ -236,6 +237,69 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
QTRY_COMPARE(spacing(), 10);
}
+class MarginEatingStyle : public QProxyStyle
+{
+public:
+ MarginEatingStyle() : QProxyStyle(QStyleFactory::create("windows"))
+ {
+ }
+
+ virtual QRect subElementRect(SubElement sr, const QStyleOption *opt,
+ const QWidget *widget) const
+ {
+ QRect rect = opt->rect;
+ switch (sr) {
+ case SE_GroupBoxLayoutItem:
+ // this is a simplifed version of what the macOS style does
+ rect.setTop(rect.top() + 20);
+ rect.setLeft(rect.left() + 20);
+ rect.setRight(rect.right() - 20);
+ rect.setBottom(rect.bottom() - 20);
+ break;
+ default:
+ return QProxyStyle::subElementRect(sr, opt, widget);
+ }
+
+ return rect;
+ }
+};
+
+void tst_QBoxLayout::widgetSurplus()
+{
+ // Test case for QTBUG-67608 - a style requests space in the margin
+
+ QDialog window;
+ QScopedPointer<MarginEatingStyle> marginEater(new MarginEatingStyle);
+ QVBoxLayout *vbox = new QVBoxLayout(&window);
+ vbox->setContentsMargins(0, 0, 0, 0);
+ vbox->setSpacing(0);
+
+ QLabel *hiddenLabel = new QLabel(tr("Invisible label"));
+ hiddenLabel->setVisible(false);
+
+ QGroupBox *groupBox = new QGroupBox(tr("Groupbox Title"));
+ groupBox->setStyle(marginEater.data());
+ groupBox->setObjectName("Test group box");
+ QPushButton *button1 = new QPushButton(tr("Button 1"));
+ QPushButton *button2 = new QPushButton(tr("Button 2"));
+ QVBoxLayout *groupLayout = new QVBoxLayout;
+ groupLayout->addWidget(button1);
+ groupLayout->addWidget(button2);
+ groupBox->setLayout(groupLayout);
+
+ QLabel *label = new QLabel(tr("Visible label"));
+
+ vbox->addWidget(hiddenLabel);
+ vbox->addWidget(groupBox);
+ vbox->addWidget(label);
+ window.setLayout(vbox);
+
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QCOMPARE(groupBox->y(), 0);
+ QCOMPARE(groupBox->x(), 0);
+}
+
void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected()
{
QLabel *label = new QLabel("Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language. Qt can also be used in several other programming languages via language bindings. It runs on all major platforms, and has extensive internationalization support. Non-GUI features include SQL database access, XML parsing, thread management, network support and a unified cross-platform API for file handling.");
@@ -507,6 +571,10 @@ void tst_QBoxLayout::replaceWidget()
QCOMPARE(boxLayout->indexOf(replaceFrom), 1);
QCOMPARE(boxLayout->indexOf(replaceTo), -1);
+ QCOMPARE(boxLayout->count(), 3);
+ boxLayout->replaceWidget(replaceFrom, replaceFrom);
+ QCOMPARE(boxLayout->count(), 3);
+
delete boxLayout->replaceWidget(replaceFrom, replaceTo);
QCOMPARE(boxLayout->indexOf(replaceFrom), -1);
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index cff3dad35e..ab32643061 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -52,7 +52,7 @@ using namespace QTestPrivate;
Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3);
struct QFormLayoutTakeRowResultHolder {
- QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) Q_DECL_NOTHROW
+ QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) noexcept
: labelItem(result.labelItem),
fieldItem(result.fieldItem)
{
@@ -66,20 +66,20 @@ struct QFormLayoutTakeRowResultHolder {
if (fieldItem)
disposer.setItem(0, QFormLayout::FieldRole, fieldItem);
}
- QFormLayoutTakeRowResultHolder(QFormLayoutTakeRowResultHolder &&other) Q_DECL_NOTHROW
+ QFormLayoutTakeRowResultHolder(QFormLayoutTakeRowResultHolder &&other) noexcept
: labelItem(other.labelItem),
fieldItem(other.fieldItem)
{
other.labelItem = nullptr;
other.fieldItem = nullptr;
}
- QFormLayoutTakeRowResultHolder &operator=(QFormLayoutTakeRowResultHolder &&other) Q_DECL_NOTHROW
+ QFormLayoutTakeRowResultHolder &operator=(QFormLayoutTakeRowResultHolder &&other) noexcept
{
swap(other);
return *this;
}
- void swap(QFormLayoutTakeRowResultHolder &other) Q_DECL_NOTHROW
+ void swap(QFormLayoutTakeRowResultHolder &other) noexcept
{
qSwap(labelItem, other.labelItem);
qSwap(fieldItem, other.fieldItem);
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 5e0327319b..1d63d140fb 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -219,9 +219,9 @@ void tst_QGridLayout::badDistributionBug()
QDialog dialog;
Ui::SortDialog ui;
ui.setupUi(&dialog);
- ui.gridLayout->setMargin(0);
+ ui.gridLayout->setContentsMargins(0, 0, 0, 0);
ui.gridLayout->setSpacing(0);
- ui.vboxLayout->setMargin(0);
+ ui.vboxLayout->setContentsMargins(0, 0, 0, 0);
ui.vboxLayout->setSpacing(0);
ui.okButton->setFixedHeight(20);
ui.moreButton->setFixedHeight(20);
@@ -237,7 +237,7 @@ void tst_QGridLayout::setMinAndMaxSize()
QWidget widget;
setFrameless(&widget);
QGridLayout layout(&widget);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
layout.setSpacing(0);
layout.setSizeConstraint(QLayout::SetMinAndMaxSize);
widget.show();
@@ -396,7 +396,7 @@ void tst_QGridLayout::spacingAndSpacers()
QWidget widget;
setFrameless(&widget);
QGridLayout layout(&widget);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
layout.setSpacing(0);
widget.show();
@@ -1541,7 +1541,7 @@ void tst_QGridLayout::spacerWithSpacing()
QWidget window;
QGridLayout layout(&window);
layout.setSpacing(1);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
populate(&layout, 0, i);
populate(&layout, 1, j);
populate(&layout, 2, k);
@@ -1651,7 +1651,7 @@ void tst_QGridLayout::taskQTBUG_52357_spacingWhenItemIsHidden()
QWidget widget;
setFrameless(&widget);
QGridLayout layout(&widget);
- layout.setMargin(0);
+ layout.setContentsMargins(0, 0, 0, 0);
layout.setSpacing(5);
QPushButton button1;
layout.addWidget(&button1, 0, 0);
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index 936f581d89..140a367afe 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -308,7 +308,7 @@ void tst_QLayout::controlTypes2()
{
QWidget main;
QVBoxLayout *const layout = new QVBoxLayout(&main);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
QComboBox *combo = new QComboBox(&main);
layout->addWidget(combo);
QCOMPARE(layout->controlTypes(), QSizePolicy::ComboBox);
@@ -319,7 +319,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
QWidget main;
QVBoxLayout *const layout = new QVBoxLayout(&main);
- layout->setMargin(0);
+ layout->setContentsMargins(0, 0, 0, 0);
SizeHinterFrame *frame = new SizeHinterFrame(QSize(200, 10), QSize(200, 8));
frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
layout->addWidget(frame);
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index 2c9295d995..8c262ff3a5 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -41,7 +41,6 @@
#include <qshortcut.h>
#include <qscreen.h>
-class AccelForm;
QT_BEGIN_NAMESPACE
class QMainWindow;
class QTextEdit;
@@ -51,15 +50,14 @@ class tst_QShortcut : public QObject
{
Q_OBJECT
public:
- tst_QShortcut();
- virtual ~tst_QShortcut();
-
enum Action {
SetupAccel,
TestAccel,
- ClearAll
- } currentAction;
+ ClearAll,
+ TestEnd
+ };
+ Q_ENUM(Action)
enum Widget {
NoWidget,
@@ -70,8 +68,8 @@ public:
TriggerSlot5,
TriggerSlot6,
TriggerSlot7,
- SendKeyEvent
};
+ Q_ENUM(Widget)
enum Result {
NoResult,
@@ -84,7 +82,8 @@ public:
Slot7Triggered,
SentKeyEvent,
Ambiguous
- } currentResult;
+ } currentResult = NoResult;
+ Q_ENUM(Result)
public slots:
void slotTrig1() { currentResult = Slot1Triggered; }
@@ -101,16 +100,9 @@ public slots:
void ambigSlot5() { currentResult = Ambiguous; ambigResult = Slot5Triggered; }
void ambigSlot6() { currentResult = Ambiguous; ambigResult = Slot6Triggered; }
void ambigSlot7() { currentResult = Ambiguous; ambigResult = Slot7Triggered; }
- void statusMessage( const QString& message ) { sbText = message; }
- void shortcutDestroyed(QObject* obj);
- void sendKeyEvent() { sendKeyEvents(edit, Qt::CTRL + Qt::Key_B, 0); currentResult = SentKeyEvent; }
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
- void cleanup() { QCOMPARE(QApplication::topLevelWidgets().size(), 1); }
private slots:
+ void cleanup();
void number_data();
void number();
void text_data();
@@ -128,29 +120,19 @@ protected:
static Qt::KeyboardModifiers toButtons( int key );
void defElements();
- void clearAllShortcuts();
- QShortcut *setupShortcut(int testWidget, const QKeySequence &ks);
- QShortcut *setupShortcut(int testWidget, const QString &txt, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0);
-
- QShortcut *setupShortcut(QWidget *parent, const char *name, int testWidget, const QString &txt, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0);
- QShortcut *setupShortcut(QWidget *parent, const char *name, int testWidget, const QKeySequence &ks, Qt::ShortcutContext context = Qt::WindowShortcut);
+ QShortcut *setupShortcut(QWidget *parent, const QString &name, const QKeySequence &ks,
+ Qt::ShortcutContext context = Qt::WindowShortcut);
+ QShortcut *setupShortcut(QWidget *parent, const QString &name, Widget testWidget,
+ const QKeySequence &ks, Qt::ShortcutContext context = Qt::WindowShortcut);
- void sendKeyEvents(QWidget *w, int k1, QChar c1 = 0, int k2 = 0, QChar c2 = 0, int k3 = 0, QChar c3 = 0, int k4 = 0, QChar c4 = 0);
- void sendKeyEvents(int k1, QChar c1 = 0, int k2 = 0, QChar c2 = 0, int k3 = 0, QChar c3 = 0, int k4 = 0, QChar c4 = 0);
+ static void sendKeyEvents(QWidget *w, int k1, QChar c1 = 0, int k2 = 0, QChar c2 = 0,
+ int k3 = 0, QChar c3 = 0, int k4 = 0, QChar c4 = 0);
void testElement();
- QMainWindow *mainW;
- QList<QShortcut*> shortcuts;
- QTextEdit *edit;
- QString sbText;
Result ambigResult;
};
-Q_DECLARE_METATYPE(tst_QShortcut::Widget);
-Q_DECLARE_METATYPE(tst_QShortcut::Result);
-Q_DECLARE_METATYPE(tst_QShortcut::Action);
-
class TestEdit : public QTextEdit
{
Q_OBJECT
@@ -162,7 +144,8 @@ public:
}
protected:
- bool event(QEvent *e) {
+ bool event(QEvent *e) override
+ {
// Make testedit allow any Ctrl+Key as shortcut
if (e->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
@@ -195,33 +178,28 @@ protected:
}
};
-tst_QShortcut::tst_QShortcut(): mainW( 0 )
+class MainWindow : public QMainWindow
{
-}
+public:
+ MainWindow();
-tst_QShortcut::~tst_QShortcut()
-{
- clearAllShortcuts();
-}
+ TestEdit *testEdit() const { return m_testEdit; }
-void tst_QShortcut::initTestCase()
+private:
+ TestEdit *m_testEdit;
+};
+
+MainWindow::MainWindow()
{
- currentResult = NoResult;
- mainW = new QMainWindow(0);
- mainW->setWindowFlags(Qt::X11BypassWindowManagerHint);
- edit = new TestEdit(mainW, "test_edit");
- mainW->setFixedSize( 200, 200 );
- mainW->setCentralWidget( edit );
- mainW->show();
- mainW->activateWindow();
- QVERIFY(QTest::qWaitForWindowActive(mainW));
- connect( mainW->statusBar(), SIGNAL(messageChanged(QString)),
- this, SLOT(statusMessage(QString)) );
+ setWindowFlags(Qt::X11BypassWindowManagerHint);
+ m_testEdit = new TestEdit(this, "test_edit");
+ setCentralWidget(m_testEdit);
+ setFixedSize(200, 200);
}
-void tst_QShortcut::cleanupTestCase()
+void tst_QShortcut::cleanup()
{
- delete mainW;
+ QVERIFY(QApplication::topLevelWidgets().size() <= 1); // The data driven tests keep a widget around
}
Qt::KeyboardModifiers tst_QShortcut::toButtons( int key )
@@ -276,7 +254,7 @@ void tst_QShortcut::number_data()
defElements();
// Clear all
- QTest::newRow("N00 - clear") << ClearAll << NoWidget <<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<<NoResult;
+ QTest::newRow("N00 - clear") << ClearAll << NoWidget <<QString()<<0<<0<<0<<0<<0<<0<<0<<0<<NoResult;
//===========================================
// [Shift + key] on non-shift shortcuts testing
@@ -288,15 +266,15 @@ void tst_QShortcut::number_data()
Shift + Qt::Key_Plus on Qt::Key_Pluss
Qt::Key_Plus on Qt::Key_Pluss
*/
- QTest::newRow("N001 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N001 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("N001:Shift + M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N001:M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N001 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ //QTest::newRow("N001:Shift + M - [M]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N001:M - [M]") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N001 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("N001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ //QTest::newRow("N001:Shift++ [+]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N001:+ [+]") << TestAccel << NoWidget << QString() << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N001 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_M on Shift + Qt::Key_M
@@ -304,32 +282,32 @@ void tst_QShortcut::number_data()
Shift + Qt::Key_Plus on Shift + Qt::Key_Pluss
Qt::Key_Plus on Shift + Qt::Key_Pluss
*/
- QTest::newRow("N002 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N002:M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N002 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N002 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::SHIFT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N002:M - [Shift+M]") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N002 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::SHIFT + Qt::Key_Plus) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N002:Shift++ [Shift++]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N002:+ [Shift++]") << TestAccel << NoWidget << QString() << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N002 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Qt::Key_F1
Qt::Key_F1 on Qt::Key_F1
*/
- QTest::newRow("N003 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N003 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("N003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ //QTest::newRow("N003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N003:F1 - [F1]") << TestAccel << NoWidget << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N003 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Shift + Qt::Key_F1
Qt::Key_F1 on Shift + Qt::Key_F1
*/
- QTest::newRow("N004 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N004:Shift+F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N004 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N004:Shift+F1 - [Shift+F1]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N004 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Qt::Key_Tab
@@ -337,14 +315,14 @@ void tst_QShortcut::number_data()
Qt::Key_Backtab on Qt::Key_Tab
Shift + Qt::Key_Backtab on Qt::Key_Tab
*/
- QTest::newRow("N005a - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N005a:Tab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N005a - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N005a:Tab - [Tab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("N005a:Shift+Tab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ //QTest::newRow("N005a:Shift+Tab - [Tab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
// (Shift+)BackTab != Tab, but Shift+BackTab == Shift+Tab
- QTest::newRow("N005a:Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N005a:Shift+Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N005a - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N005a:Backtab - [Tab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N005a:Shift+Backtab - [Tab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N005a - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Shift + Qt::Key_Tab
@@ -352,12 +330,12 @@ void tst_QShortcut::number_data()
Qt::Key_Backtab on Shift + Qt::Key_Tab
Shift + Qt::Key_Backtab on Shift + Qt::Key_Tab
*/
- QTest::newRow("N005b - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N005b:Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N005b:Shift+Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N005b:BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N005b:Shift+BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N005b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N005b - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N005b:Tab - [Shift+Tab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N005b:Shift+Tab - [Shift+Tab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N005b:BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N005b:Shift+BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N005b - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Qt::Key_Backtab
@@ -365,15 +343,15 @@ void tst_QShortcut::number_data()
Qt::Key_Backtab on Qt::Key_Backtab
Shift + Qt::Key_Backtab on Qt::Key_Backtab
*/
- QTest::newRow("N006a - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N006a:Tab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N006a - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N006a:Tab - [BackTab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
// This should work, since platform dependent code will transform the
// Shift+Tab into a Shift+BackTab, which should trigger the shortcut
- QTest::newRow("N006a:Shift+Tab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL
- QTest::newRow("N006a:BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N006a:Shift+Tab - [BackTab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL
+ QTest::newRow("N006a:BackTab - [BackTab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("N006a:Shift+BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N006a - clear") << ClearAll << NoWidget<< QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ //QTest::newRow("N006a:Shift+BackTab - [BackTab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N006a - clear") << ClearAll << NoWidget<< QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Shift + Qt::Key_Backtab
@@ -381,12 +359,12 @@ void tst_QShortcut::number_data()
Qt::Key_Backtab on Shift + Qt::Key_Backtab
Shift + Qt::Key_Backtab on Shift + Qt::Key_Backtab
*/
- QTest::newRow("N006b - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N006b:Tab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N006b:Shift+Tab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N006b:BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N006b:Shift+BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL
- QTest::newRow("N006b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N006b - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N006b:Tab - [Shift+BackTab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N006b:Shift+Tab - [Shift+BackTab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N006b:BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString() << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N006b:Shift+BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL
+ QTest::newRow("N006b - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
//===========================================
// [Shift + key] and [key] on shortcuts with
@@ -397,11 +375,11 @@ void tst_QShortcut::number_data()
Qt::Key_F1
Shift + Qt::Key_F1
*/
- QTest::newRow("N007 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N007 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N007 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N007 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N007:F1") << TestAccel << NoWidget << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N007:Shift + F1") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N007 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_M
@@ -409,51 +387,51 @@ void tst_QShortcut::number_data()
Ctrl + Qt::Key_M
Alt + Qt::Key_M
*/
- QTest::newRow("N01 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N02 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N03 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N04 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N:Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N:Shift+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N:Ctrl+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N:Alt+Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N01 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N02 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N03 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N04 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N:Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N:Shift+Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N:Ctrl+Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N:Alt+Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
/* Testing Single Sequence Ambiguity
Qt::Key_M on shortcut2
*/
- QTest::newRow("N05 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N:Qt::Key_M on slot") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous;
- QTest::newRow("N05 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N05 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N:Qt::Key_M on slot") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous;
+ QTest::newRow("N05 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Specialkeys
Qt::Key_aring
Qt::Key_Aring
Qt::UNICODE_ACCEL + Qt::Key_K
*/
- QTest::newRow("N06 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N07 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N08 - slot2") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N06 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N07 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N08 - slot2") << SetupAccel << TriggerSlot1 << QString() << int(Qt::UNICODE_ACCEL + Qt::Key_K) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N:Qt::Key_aring") << TestAccel << NoWidget << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N:Qt::Key_Aring") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N:Qt::Key_aring") << TestAccel << NoWidget << QString() << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N:Qt::Key_Aring") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString() << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString() << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N09 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Multiple Sequences
Qt::Key_M
Qt::Key_I, Qt::Key_M
Shift+Qt::Key_I, Qt::Key_M
*/
- QTest::newRow("N10 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N11 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N12 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult;
-
- QTest::newRow("N:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("N10 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N11 - slot2") << SetupAccel << TriggerSlot2 << QString() << int(Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("N12 - slot1") << SetupAccel << TriggerSlot1 << QString() << int(Qt::SHIFT + Qt::Key_I) << 0 << int(Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << NoResult;
+
+ QTest::newRow("N:Qt::Key_M (2)") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("N:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("N:end") << TestEnd << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
}
// ------------------------------------------------------------------
@@ -463,7 +441,7 @@ void tst_QShortcut::text_data()
{
defElements();
// Clear all
- QTest::newRow("T00 - clear") << ClearAll << NoWidget <<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<< NoResult;
+ QTest::newRow("T00 - clear") << ClearAll << NoWidget <<QString()<<0<<0<<0<<0<<0<<0<<0<<0<< NoResult;
//===========================================
// [Shift + key] on non-shift shortcuts testing
@@ -477,13 +455,13 @@ void tst_QShortcut::text_data()
*/
QTest::newRow("T001 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("T001:Shift+M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T001:M - [M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ //QTest::newRow("T001:Shift+M - [M]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T001:M - [M]") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T001 - slot2") << SetupAccel << TriggerSlot2 << QString("+") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("T001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ //QTest::newRow("T001:Shift++ [+]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T001:+ [+]") << TestAccel << NoWidget << QString() << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T001 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_M on Shift + Qt::Key_M
@@ -494,12 +472,12 @@ void tst_QShortcut::text_data()
Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Pluss
*/
QTest::newRow("T002 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T002:M - [Shift+M]") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("T002:Shift+M - [Shift+M]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T002:M - [Shift+M]") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T002 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("T002:Shift++ [Shift++]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T002:+ [Shift++]") << TestAccel << NoWidget << QString() << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("T002 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Plus
@@ -508,10 +486,10 @@ void tst_QShortcut::text_data()
*/
QTest::newRow("T002b - slot1") << SetupAccel << TriggerSlot1 << QString("Ctrl++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("T002b:Shift+Ctrl++ [Ctrl++]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T002b:Ctrl++ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T002b:+ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T002b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ //QTest::newRow("T002b:Shift+Ctrl++ [Ctrl++]")<< TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T002b:Ctrl++ [Ctrl++]") << TestAccel << NoWidget << QString() << int(Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T002b:+ [Ctrl++]") << TestAccel << NoWidget << QString() << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("T002b - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Qt::Key_F1
@@ -519,18 +497,18 @@ void tst_QShortcut::text_data()
*/
QTest::newRow("T003 - slot1") << SetupAccel << TriggerSlot1 << QString("F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
//commented out because the behaviour changed, those tests should be updated
- //QTest::newRow("T003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ //QTest::newRow("T003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T003:F1 - [F1]") << TestAccel << NoWidget << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T003 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Shift + Qt::Key_F1
Qt::Key_F1 on Shift + Qt::Key_F1
*/
QTest::newRow("T004 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T004:Shift+F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("T004:Shift+F1 - [Shift+F1]") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("T004 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
//===========================================
// [Shift + key] and [key] on shortcuts with
@@ -543,9 +521,9 @@ void tst_QShortcut::text_data()
*/
QTest::newRow("T007 - slot1") << SetupAccel << TriggerSlot1 << QString("F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T007 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("T007:F1") << TestAccel << NoWidget << QString() << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T007:Shift + F1") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T007 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_M
@@ -558,17 +536,17 @@ void tst_QShortcut::text_data()
QTest::newRow("T03 - slot1") << SetupAccel << TriggerSlot1 << QString("Ctrl+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T04 - slot2") << SetupAccel << TriggerSlot2 << QString("Alt+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T:Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T:Shift + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T:Ctrl + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T:Alt + Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T:Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T:Shift + Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_M) << int('M') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T:Ctrl + Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::CTRL + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T:Alt + Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::ALT + Qt::Key_M) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
/* Testing Single Sequence Ambiguity
Qt::Key_M on shortcut2
*/
QTest::newRow("T05 - slot2") << SetupAccel << TriggerSlot2 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T:Qt::Key_M on TriggerSlot2") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous;
- QTest::newRow("T06 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("T:Qt::Key_M on TriggerSlot2") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous;
+ QTest::newRow("T06 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Specialkeys
Qt::Key_aring
@@ -579,12 +557,12 @@ void tst_QShortcut::text_data()
QTest::newRow("T06 - slot1") << SetupAccel << TriggerSlot1 << QString::fromLatin1("\x0C5")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T07 - slot2") << SetupAccel << TriggerSlot2 << QString::fromLatin1("Shift+\x0C5")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T08 - slot2") << SetupAccel << TriggerSlot1 << QString("K") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T:Qt::Key_aring") << TestAccel << NoWidget << QString("") << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T:Qt::Key_Aring") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("T:Qt::Key_aring") << TestAccel << NoWidget << QString() << int(Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T:Qt::Key_Aring") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+Qt::Key_Aring) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString() << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString() << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T:Qt::UNICODE_ACCEL + Qt::Key_K")<< TestAccel << NoWidget << QString() << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T09 - clear") << ClearAll << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Multiple Sequences
Qt::Key_M
@@ -594,10 +572,38 @@ void tst_QShortcut::text_data()
QTest::newRow("T10 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T11 - slot2") << SetupAccel << TriggerSlot2 << QString("I, M")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T12 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+I, M")<< 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
+ QTest::newRow("T:Qt::Key_M (2)") << TestAccel << NoWidget << QString() << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered;
+ QTest::newRow("T:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString() << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered;
+ QTest::newRow("T:end") << TestEnd << NoWidget << QString() << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+}
+
+class ButtonWidget : public QWidget
+{
+public:
+ ButtonWidget();
+
+ QPushButton *pushButton1() const { return m_pb1; }
+ QPushButton *pushButton2() const { return m_pb2; }
+
+private:
+ QPushButton *m_pb1;
+ QPushButton *m_pb2;
+};
+
+ButtonWidget::ButtonWidget()
+{
+ // Setup two identical shortcuts on different pushbuttons
+ QString name = QLatin1String("pushbutton-1");
+ m_pb1 = new QPushButton(name, this);
+ m_pb1->setObjectName(name);
+ name = QLatin1String("pushbutton-2");
+ m_pb2 = new QPushButton(name, this);
+ m_pb2->setObjectName(name);
+ auto hLayout = new QHBoxLayout(this);
+ hLayout->addWidget(m_pb1);
+ hLayout->addWidget(m_pb2);
+ hLayout->addStretch();
}
// ------------------------------------------------------------------
@@ -605,9 +611,11 @@ void tst_QShortcut::text_data()
// ------------------------------------------------------------------
void tst_QShortcut::disabledItems()
{
- clearAllShortcuts();
- mainW->activateWindow();
- QVERIFY(QTest::qWaitForWindowActive(mainW));
+ ButtonWidget mainW;
+ mainW.setWindowTitle(QTest::currentTestFunction());
+ mainW.show();
+ mainW.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&mainW));
/* Testing Disabled Shortcuts
Qt::Key_M on slot1
@@ -617,27 +625,27 @@ void tst_QShortcut::disabledItems()
*/
// Setup two identical shortcuts on different pushbuttons
- QPushButton pb1(mainW);
- QPushButton pb2(mainW);
- pb1.setObjectName("pushbutton-1");
- pb2.setObjectName("pushbutton-2");
- pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
- pb2.show();
-
- QShortcut *cut1 = setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M");
- QShortcut *cut2 = setupShortcut(&pb1, "shortcut2-pb1", TriggerSlot1, "Shift+M");
- QShortcut *cut3 = setupShortcut(&pb2, "shortcut3-pb2", TriggerSlot2, "M");
- QShortcut *cut4 = setupShortcut(&pb2, "shortcut4-pb2", TriggerSlot2, "Shift+M");
+ auto pb1 = mainW.pushButton1();
+ auto pb2 = mainW.pushButton2();
+ const int shiftM = Qt::SHIFT + Qt::Key_M;
+ QShortcut *cut1 = setupShortcut(pb1, "shortcut1-pb1", TriggerSlot1,
+ QKeySequence(Qt::Key_M));
+ QShortcut *cut2 = setupShortcut(pb1, "shortcut2-pb1", TriggerSlot1,
+ QKeySequence(shiftM));
+ QShortcut *cut3 = setupShortcut(pb2, "shortcut3-pb2", TriggerSlot2,
+ QKeySequence(Qt::Key_M));
+ QShortcut *cut4 = setupShortcut(pb2, "shortcut4-pb2", TriggerSlot2,
+ QKeySequence(shiftM));
cut3->setEnabled(false);
cut4->setEnabled(false);
currentResult = NoResult;
- sendKeyEvents(Qt::Key_M, 'm');
+ sendKeyEvents(&mainW, Qt::Key_M, 'm');
QCOMPARE(currentResult, Slot1Triggered);
currentResult = NoResult;
- sendKeyEvents(Qt::SHIFT+Qt::Key_M, 'M');
+ sendKeyEvents(&mainW, shiftM, 'M');
QCOMPARE(currentResult, Slot1Triggered);
cut2->setEnabled(false);
@@ -650,11 +658,11 @@ void tst_QShortcut::disabledItems()
Shift + Qt::Key_M on slot2
*/
currentResult = NoResult;
- sendKeyEvents( Qt::Key_M, 'm' );
+ sendKeyEvents(&mainW, Qt::Key_M, 'm' );
QCOMPARE( currentResult, Slot1Triggered );
currentResult = NoResult;
- sendKeyEvents( Qt::SHIFT+Qt::Key_M, 'M' );
+ sendKeyEvents(&mainW, shiftM, 'M' );
QCOMPARE( currentResult, Slot2Triggered );
@@ -662,67 +670,34 @@ void tst_QShortcut::disabledItems()
Qt::Key_F5 on slot1
Shift + Qt::Key_F5 on slot2 (disabled)
*/
- clearAllShortcuts();
- cut1 = setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "F5");
- cut4 = setupShortcut(&pb2, "shortcut4-pb2", TriggerSlot2, "Shift+F5");
-
- cut1->setKey(QKeySequence("F5"));
- cut4->setKey(QKeySequence("Shift+F5"));
+ qDeleteAll(mainW.findChildren<QShortcut *>());
+ const int shiftF5 = Qt::SHIFT + Qt::Key_F5;
+ cut1 = setupShortcut(pb1, "shortcut1-pb1", TriggerSlot1, QKeySequence(Qt::Key_F5));
+ cut4 = setupShortcut(pb2, "shortcut4-pb2", TriggerSlot2, QKeySequence(shiftF5));
cut1->setEnabled(true);
cut4->setEnabled(false);
currentResult = NoResult;
- sendKeyEvents( Qt::Key_F5, 0 );
+ sendKeyEvents(&mainW, Qt::Key_F5, 0 );
QCOMPARE( currentResult, Slot1Triggered );
currentResult = NoResult;
- sendKeyEvents( Qt::SHIFT+Qt::Key_F5, 0 );
- QCOMPARE( currentResult, NoResult );
-
-#if 0
- qFatal("Not testing statusbar text feedback yet, since not implemented");
- /* Testing Disabled Accel, and the corresponding statusbar feedback
- Ctrl + Qt::Key_K, Ctrl + Qt::Key_L on slot1
- Ctrl + Qt::Key_K, Ctrl + Qt::Key_M on slot2 (disabled)
- */
- cut1->setKey(QKeySequence("Ctrl+K, Ctrl+L"));
- cut4->setKey(QKeySequence("Ctrl+K, Ctrl+M"));
-
- cut1->setEnabled(true);
- cut4->setEnabled(false);
-
- currentResult = NoResult;
- sendKeyEvents( Qt::CTRL+Qt::Key_K, 0 );
- sendKeyEvents( Qt::CTRL+Qt::Key_Q, 0 );
- QCOMPARE( currentResult, NoResult );
- if (over_330)
- QCOMPARE( sbText, QString("Ctrl+K, Ctrl+Q not defined") );
-
- currentResult = NoResult;
- sendKeyEvents( Qt::CTRL+Qt::Key_K, 0 );
- sendKeyEvents( Qt::CTRL+Qt::Key_M, 0 );
+ sendKeyEvents(&mainW, shiftF5, 0 );
QCOMPARE( currentResult, NoResult );
- if (over_330)
- QCOMPARE( sbText, QString() );
-
- currentResult = NoResult;
- sendKeyEvents( Qt::CTRL+Qt::Key_K, 0 );
- sendKeyEvents( Qt::CTRL+Qt::Key_L, 0 );
- QCOMPARE( currentResult, Slot1Triggered );
- if (over_330)
- QCOMPARE( sbText, QString() );
-#endif
- clearAllShortcuts();
- cut1 = 0;
- cut4 = 0;
}
// ------------------------------------------------------------------
// Ambiguous Elements -----------------------------------------------
// ------------------------------------------------------------------
void tst_QShortcut::ambiguousRotation()
{
- clearAllShortcuts();
+ MainWindow mainW;
+ const QString name = QLatin1String(QTest::currentTestFunction());
+ mainW.setWindowTitle(name);
+ mainW.show();
+ mainW.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&mainW));
+
/* Testing Shortcut rotation scheme
Ctrl + Qt::Key_A on slot1 (disabled)
Ctrl + Qt::Key_A on slot2 (disabled)
@@ -732,13 +707,15 @@ void tst_QShortcut::ambiguousRotation()
Ctrl + Qt::Key_A on slot6
Ctrl + Qt::Key_A on slot7 (disabled)
*/
- QShortcut *cut1 = setupShortcut(TriggerSlot1, "Ctrl+A");
- QShortcut *cut2 = setupShortcut(TriggerSlot2, "Ctrl+A");
- QShortcut *cut3 = setupShortcut(TriggerSlot3, "Ctrl+A");
- QShortcut *cut4 = setupShortcut(TriggerSlot4, "Ctrl+A");
- QShortcut *cut5 = setupShortcut(TriggerSlot5, "Ctrl+A");
- QShortcut *cut6 = setupShortcut(TriggerSlot6, "Ctrl+A");
- QShortcut *cut7 = setupShortcut(TriggerSlot7, "Ctrl+A");
+ const int ctrlA = Qt::CTRL + Qt::Key_A;
+ QKeySequence ctrlA_Sequence(ctrlA);
+ QShortcut *cut1 = setupShortcut(&mainW, name, TriggerSlot1, ctrlA_Sequence);
+ QShortcut *cut2 = setupShortcut(&mainW, name, TriggerSlot2, ctrlA_Sequence);
+ QShortcut *cut3 = setupShortcut(&mainW, name, TriggerSlot3, ctrlA_Sequence);
+ QShortcut *cut4 = setupShortcut(&mainW, name, TriggerSlot4, ctrlA_Sequence);
+ QShortcut *cut5 = setupShortcut(&mainW, name, TriggerSlot5, ctrlA_Sequence);
+ QShortcut *cut6 = setupShortcut(&mainW, name, TriggerSlot6, ctrlA_Sequence);
+ QShortcut *cut7 = setupShortcut(&mainW, name, TriggerSlot7, ctrlA_Sequence);
cut1->setEnabled(false);
cut2->setEnabled(false);
@@ -752,37 +729,37 @@ void tst_QShortcut::ambiguousRotation()
// Continue...
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot3Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot4Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot6Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot3Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot4Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot6Triggered);
@@ -807,94 +784,87 @@ void tst_QShortcut::ambiguousRotation()
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot1Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot2Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot5Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot7Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot1Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot2Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot5Triggered);
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(Qt::CTRL+Qt::Key_A);
+ sendKeyEvents(&mainW, ctrlA);
QCOMPARE(currentResult, Ambiguous);
QCOMPARE(ambigResult, Slot7Triggered);
-
- clearAllShortcuts();
- cut1 = 0; cut2 = 0;
- cut3 = 0; cut4 = 0;
- cut5 = 0; cut6 = 0;
- cut7 = 0;
}
void tst_QShortcut::ambiguousItems()
{
- clearAllShortcuts();
+ ButtonWidget mainW;
+ mainW.setWindowTitle(QTest::currentTestFunction());
+ mainW.show();
+ mainW.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&mainW));
+
/* Testing Ambiguous Shortcuts
Qt::Key_M on Pushbutton 1
Qt::Key_M on Pushbutton 2
*/
// Setup two identical shortcuts on different pushbuttons
- QPushButton pb1(mainW);
- QPushButton pb2(mainW);
- pb1.setObjectName("pushbutton-1");
- pb2.setObjectName("pushbutton-2");
- pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
- pb2.show();
+ auto pb1 = mainW.pushButton1();
+ auto pb2 = mainW.pushButton2();
- setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M");
- setupShortcut(&pb1, "shortcut2-pb2", TriggerSlot2, "M");
+ setupShortcut(pb1, "shortcut1-pb1", TriggerSlot1, QKeySequence(Qt::Key_M));
+ setupShortcut(pb2, "shortcut2-pb2", TriggerSlot2, QKeySequence(Qt::Key_M));
currentResult = NoResult;
- sendKeyEvents( Qt::Key_M, 'm' );
+ sendKeyEvents(&mainW, Qt::Key_M, 'm' );
QCOMPARE( currentResult, Ambiguous );
QCOMPARE( ambigResult, Slot1Triggered );
currentResult = NoResult;
- sendKeyEvents( Qt::Key_M, 'm' );
+ sendKeyEvents(&mainW, Qt::Key_M, 'm' );
QCOMPARE( currentResult, Ambiguous );
QCOMPARE( ambigResult, Slot2Triggered );
currentResult = NoResult;
- sendKeyEvents( Qt::Key_M, 'm' );
+ sendKeyEvents(&mainW, Qt::Key_M, 'm' );
QCOMPARE( currentResult, Ambiguous );
QCOMPARE( ambigResult, Slot1Triggered );
-
- clearAllShortcuts();
}
@@ -903,32 +873,31 @@ void tst_QShortcut::ambiguousItems()
// ------------------------------------------------------------------
void tst_QShortcut::unicodeCompare()
{
- clearAllShortcuts();
+ ButtonWidget mainW;
+ mainW.setWindowTitle(QTest::currentTestFunction());
+ mainW.show();
+ mainW.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&mainW));
+
/* Testing Unicode/non-Unicode Shortcuts
Qt::Key_M on Pushbutton 1
Qt::Key_M on Pushbutton 2
*/
- QPushButton pb1(mainW);
- QPushButton pb2(mainW);
- pb1.setObjectName("pushbutton-1");
- pb2.setObjectName("pushbutton-2");
- pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
- pb2.show();
+ auto pb1 = mainW.pushButton1();
+ auto pb2 = mainW.pushButton2();
QKeySequence ks1("Ctrl+M"); // Unicode
QKeySequence ks2(Qt::CTRL+Qt::Key_M); // non-Unicode
- setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, ks1);
- setupShortcut(&pb1, "shortcut2-pb2", TriggerSlot2, ks2);
+ setupShortcut(pb1, "shortcut1-pb1", TriggerSlot1, ks1);
+ setupShortcut(pb2, "shortcut2-pb2", TriggerSlot2, ks2);
currentResult = NoResult;
- sendKeyEvents( Qt::CTRL+Qt::Key_M, 0 );
+ sendKeyEvents(&mainW, Qt::CTRL + Qt::Key_M, 0);
QCOMPARE( currentResult, Ambiguous );
// They _are_ ambiguous, so the QKeySequence operator==
// should indicate the same
QVERIFY( ks1 == ks2 );
QVERIFY( !(ks1 != ks2) );
-
- clearAllShortcuts();
}
// ------------------------------------------------------------------
@@ -936,25 +905,29 @@ void tst_QShortcut::unicodeCompare()
// ------------------------------------------------------------------
void tst_QShortcut::keypressConsumption()
{
- clearAllShortcuts();
- edit->clear();
- QCOMPARE(edit->toPlainText().size(), 0);
+ MainWindow mainW;
+ mainW.setWindowTitle(QTest::currentTestFunction());
+ mainW.show();
+ mainW.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&mainW));
+ auto edit = mainW.testEdit();
- QShortcut *cut1 = setupShortcut(edit, "shortcut1-line", TriggerSlot1, "Ctrl+I, A");
- QShortcut *cut2 = setupShortcut(edit, "shortcut1-line", TriggerSlot2, "Ctrl+I, B");
+ const int ctrlI = Qt::CTRL + Qt::Key_I;
+ QShortcut *cut1 = setupShortcut(edit, "shortcut1-line", TriggerSlot1, QKeySequence(ctrlI, Qt::Key_A));
+ QShortcut *cut2 = setupShortcut(edit, "shortcut1-line", TriggerSlot2, QKeySequence(ctrlI, Qt::Key_B));
currentResult = NoResult;
ambigResult = NoResult;
- sendKeyEvents(edit, Qt::CTRL + Qt::Key_I, 0); // Send key to edit
+ sendKeyEvents(edit, ctrlI, 0); // Send key to edit
QCOMPARE( currentResult, NoResult );
QCOMPARE( ambigResult, NoResult );
- QCOMPARE(edit->toPlainText(), QString(""));
+ QCOMPARE(edit->toPlainText(), QString());
// Make sure next keypress is eaten (failing multiple keysequence)
sendKeyEvents(edit, Qt::Key_C, 'c'); // Send key to edit
QCOMPARE( currentResult, NoResult );
QCOMPARE( ambigResult, NoResult );
- QCOMPARE(edit->toPlainText(), QString(""));
+ QCOMPARE(edit->toPlainText(), QString());
// Next keypress should be normal
sendKeyEvents(edit, Qt::Key_C, 'c'); // Send key to edit
@@ -982,11 +955,15 @@ void tst_QShortcut::keypressConsumption()
QCOMPARE( ambigResult, NoResult );
QVERIFY(edit->toPlainText().endsWith("<Ctrl+I>a"));
- clearAllShortcuts();
+ qDeleteAll(mainW.findChildren<QShortcut *>());
edit->clear();
QCOMPARE(edit->toPlainText().size(), 0);
- setupShortcut(edit, "first", SendKeyEvent, "Ctrl+A");
+ auto cut = setupShortcut(edit, QLatin1String("first"), QKeySequence(Qt::CTRL + Qt::Key_A));
+ connect(cut, &QShortcut::activated, edit, [this, edit] () {
+ this->sendKeyEvents(edit, Qt::CTRL + Qt::Key_B, 0);
+ this->currentResult = tst_QShortcut::SentKeyEvent;
+ });
// Verify reentrancy when a non-shortcut is triggered as part
// of shortcut processing.
@@ -995,7 +972,7 @@ void tst_QShortcut::keypressConsumption()
sendKeyEvents(edit, Qt::CTRL + Qt::Key_A, 0);
QCOMPARE(currentResult, SentKeyEvent);
QCOMPARE(ambigResult, NoResult);
- QCOMPARE(edit->toPlainText(), QString(QString("<Ctrl+B>")));
+ QCOMPARE(edit->toPlainText(), QLatin1String("<Ctrl+B>"));
}
// ------------------------------------------------------------------
@@ -1003,12 +980,17 @@ void tst_QShortcut::keypressConsumption()
// ------------------------------------------------------------------
void tst_QShortcut::context()
{
- clearAllShortcuts();
+ const QString name = QLatin1String(QTest::currentTestFunction());
+ MainWindow mainW;
+ mainW.setWindowTitle(name + QLatin1String("_Helper"));
+ mainW.show();
+ auto edit = mainW.testEdit();
QWidget myBox;
- TestEdit *other1 = new TestEdit(&myBox, "test_edit_other1");
- TestEdit *other2 = new TestEdit(&myBox, "test_edit_other2");
- QHBoxLayout *layout = new QHBoxLayout(&myBox);
+ myBox.setWindowTitle(name);
+ auto other1 = new TestEdit(&myBox, "test_edit_other1");
+ auto other2 = new TestEdit(&myBox, "test_edit_other2");
+ auto layout = new QHBoxLayout(&myBox);
layout->addWidget(other1);
layout->addWidget(other2);
myBox.show();
@@ -1033,8 +1015,8 @@ void tst_QShortcut::context()
// Focus on 'other1' edit, so Active Window context should trigger
other1->activateWindow(); // <---
QApplication::setActiveWindow(other1);
- QCOMPARE(qApp->activeWindow(), other1->window());
- QCOMPARE(qApp->focusWidget(), (QWidget *)other1);
+ QCOMPARE(QApplication::activeWindow(), other1->window());
+ QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(other1));
currentResult = NoResult;
ambigResult = NoResult;
@@ -1042,13 +1024,13 @@ void tst_QShortcut::context()
other1->clear();
other2->clear();
- QCOMPARE(qApp->focusWidget(), (QWidget *)other1);
+ QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(other1));
sendKeyEvents(other1, Qt::ALT+Qt::Key_1);
QCOMPARE(currentResult, Slot1Triggered);
QCOMPARE(ambigResult, NoResult);
- QCOMPARE(edit->toPlainText(), QString(""));
- QCOMPARE(other1->toPlainText(), QString(""));
- QCOMPARE(other2->toPlainText(), QString(""));
+ QCOMPARE(edit->toPlainText(), QString());
+ QCOMPARE(other1->toPlainText(), QString());
+ QCOMPARE(other2->toPlainText(), QString());
// ..but not Focus context on 'other2'..
currentResult = NoResult;
@@ -1060,9 +1042,9 @@ void tst_QShortcut::context()
sendKeyEvents(other1, Qt::ALT+Qt::Key_2);
QCOMPARE(currentResult, NoResult);
QCOMPARE(ambigResult, NoResult);
- QCOMPARE(edit->toPlainText(), QString(""));
+ QCOMPARE(edit->toPlainText(), QString());
QCOMPARE(other1->toPlainText(), QString("<Alt+2>"));
- QCOMPARE(other2->toPlainText(), QString(""));
+ QCOMPARE(other2->toPlainText(), QString());
// ..however, application global context on 'edit' should..
currentResult = NoResult;
@@ -1074,15 +1056,15 @@ void tst_QShortcut::context()
sendKeyEvents(other1, Qt::ALT+Qt::Key_3);
QCOMPARE(currentResult, Slot3Triggered);
QCOMPARE(ambigResult, NoResult);
- QCOMPARE(edit->toPlainText(), QString(""));
- QCOMPARE(other1->toPlainText(), QString(""));
- QCOMPARE(other2->toPlainText(), QString(""));
+ QCOMPARE(edit->toPlainText(), QString());
+ QCOMPARE(other1->toPlainText(), QString());
+ QCOMPARE(other2->toPlainText(), QString());
// Changing focus to 'other2' should make the Focus context there work
other2->activateWindow();
other2->setFocus(); // ###
- QTRY_COMPARE(qApp->activeWindow(), other2->window());
- QCOMPARE(qApp->focusWidget(), (QWidget *)other2);
+ QTRY_COMPARE(QApplication::activeWindow(), other2->window());
+ QCOMPARE(QApplication::focusWidget(), static_cast<QWidget *>(other2));
currentResult = NoResult;
ambigResult = NoResult;
@@ -1093,20 +1075,18 @@ void tst_QShortcut::context()
sendKeyEvents(other2, Qt::ALT+Qt::Key_2);
QCOMPARE(currentResult, Slot2Triggered);
QCOMPARE(ambigResult, NoResult);
- QCOMPARE(edit->toPlainText(), QString(""));
- QCOMPARE(other1->toPlainText(), QString(""));
- QCOMPARE(other2->toPlainText(), QString(""));
-
- clearAllShortcuts();
+ QCOMPARE(edit->toPlainText(), QString());
+ QCOMPARE(other1->toPlainText(), QString());
+ QCOMPARE(other2->toPlainText(), QString());
}
// QTBUG-38986, do not generate duplicated QEvent::ShortcutOverride in event processing.
class OverrideCountingWidget : public QWidget
{
public:
- OverrideCountingWidget(QWidget *parent = 0) : QWidget(parent), overrideCount(0) {}
+ using QWidget::QWidget;
- int overrideCount;
+ int overrideCount = 0;
bool event(QEvent *e) override
{
@@ -1130,95 +1110,55 @@ void tst_QShortcut::duplicatedShortcutOverride()
QCOMPARE(w.overrideCount, 1);
}
-// ------------------------------------------------------------------
-// Element Testing helper functions ---------------------------------
-// ------------------------------------------------------------------
-void tst_QShortcut::clearAllShortcuts()
-{
- QList<QShortcut *> shortcutsCpy = shortcuts;
- qDeleteAll(shortcutsCpy);
- shortcuts.clear();
-}
-
-QShortcut *tst_QShortcut::setupShortcut(int testWidget, const QKeySequence &ks)
-{
- return setupShortcut(mainW, QTest::currentDataTag() ? QTest::currentDataTag() : "", testWidget, ks);
-}
-
-QShortcut *tst_QShortcut::setupShortcut(int testWidget, const QString &txt, int k1, int k2, int k3, int k4)
-{
- return setupShortcut(mainW, QTest::currentDataTag() ? QTest::currentDataTag() : "", testWidget,
- (txt.isEmpty() ? QKeySequence(k1, k2, k3, k4) : QKeySequence(txt)));
-}
-
-QShortcut *tst_QShortcut::setupShortcut(QWidget *parent, const char *name, int testWidget, const QString &txt, int k1, int k2, int k3, int k4)
+QShortcut *tst_QShortcut::setupShortcut(QWidget *parent, const QString &name, const QKeySequence &ks, Qt::ShortcutContext context)
{
- return setupShortcut(parent, name, testWidget,
- (txt.isEmpty() ? QKeySequence(k1, k2, k3, k4) : QKeySequence(txt)));
+ // Set up shortcut for next test
+ auto cut = new QShortcut(ks, parent, nullptr, nullptr, context);
+ cut->setObjectName(name);
+ return cut;
}
-QShortcut *tst_QShortcut::setupShortcut(QWidget *parent, const char *name, int testWidget,
+QShortcut *tst_QShortcut::setupShortcut(QWidget *parent, const QString &name, Widget testWidget,
const QKeySequence &ks, Qt::ShortcutContext context)
{
// Set up shortcut for next test
- QShortcut *cut = new QShortcut(QKeySequence(), parent, 0, 0, context);
- cut->setObjectName(name);
- cut->setKey(ks);
+ auto cut = setupShortcut(parent, name, ks, context);
- const char *normal = 0;
- const char *ambig = 0;
- switch(testWidget)
- {
+ switch (testWidget) {
case TriggerSlot1:
- normal = SLOT(slotTrig1());
- ambig = SLOT(ambigSlot1());
+ connect(cut, &QShortcut::activated, this, &tst_QShortcut::slotTrig1);
+ connect(cut, &QShortcut::activatedAmbiguously, this, &tst_QShortcut::ambigSlot1);
break;
case TriggerSlot2:
- normal = SLOT(slotTrig2());
- ambig = SLOT(ambigSlot2());
+ connect(cut, &QShortcut::activated, this, &tst_QShortcut::slotTrig2);
+ connect(cut, &QShortcut::activatedAmbiguously, this, &tst_QShortcut::ambigSlot2);
break;
case TriggerSlot3:
- normal = SLOT(slotTrig3());
- ambig = SLOT(ambigSlot3());
+ connect(cut, &QShortcut::activated, this, &tst_QShortcut::slotTrig3);
+ connect(cut, &QShortcut::activatedAmbiguously, this, &tst_QShortcut::ambigSlot3);
break;
case TriggerSlot4:
- normal = SLOT(slotTrig4());
- ambig = SLOT(ambigSlot4());
+ connect(cut, &QShortcut::activated, this, &tst_QShortcut::slotTrig4);
+ connect(cut, &QShortcut::activatedAmbiguously, this, &tst_QShortcut::ambigSlot4);
break;
case TriggerSlot5:
- normal = SLOT(slotTrig5());
- ambig = SLOT(ambigSlot5());
+ connect(cut, &QShortcut::activated, this, &tst_QShortcut::slotTrig5);
+ connect(cut, &QShortcut::activatedAmbiguously, this, &tst_QShortcut::ambigSlot5);
break;
case TriggerSlot6:
- normal = SLOT(slotTrig6());
- ambig = SLOT(ambigSlot6());
+ connect(cut, &QShortcut::activated, this, &tst_QShortcut::slotTrig6);
+ connect(cut, &QShortcut::activatedAmbiguously, this, &tst_QShortcut::ambigSlot6);
break;
case TriggerSlot7:
- normal = SLOT(slotTrig7());
- ambig = SLOT(ambigSlot7());
+ connect(cut, &QShortcut::activated, this, &tst_QShortcut::slotTrig7);
+ connect(cut, &QShortcut::activatedAmbiguously, this, &tst_QShortcut::ambigSlot7);
+ break;
+ case NoWidget:
break;
- case SendKeyEvent:
- normal = SLOT(sendKeyEvent());
}
- connect(cut, SIGNAL(activated()), this, normal);
- if (ambig)
- connect(cut, SIGNAL(activatedAmbiguously()), this, ambig);
- connect(cut, SIGNAL(destroyed(QObject*)), this, SLOT(shortcutDestroyed(QObject*)));
- shortcuts.append(cut);
return cut;
}
-void tst_QShortcut::shortcutDestroyed(QObject* obj)
-{
- shortcuts.erase(std::remove(shortcuts.begin(), shortcuts.end(), obj),
- shortcuts.end());
-}
-
-void tst_QShortcut::sendKeyEvents(int k1, QChar c1, int k2, QChar c2, int k3, QChar c3, int k4, QChar c4)
-{
- sendKeyEvents(mainW, k1, c1, k2, c2, k3, c3, k4, c4);
-}
-
void tst_QShortcut::sendKeyEvents(QWidget *w, int k1, QChar c1, int k2, QChar c2, int k3, QChar c3, int k4, QChar c4)
{
Qt::KeyboardModifiers b1 = toButtons( k1 );
@@ -1258,6 +1198,8 @@ void tst_QShortcut::sendKeyEvents(QWidget *w, int k1, QChar c1, int k2, QChar c2
void tst_QShortcut::testElement()
{
+ static QScopedPointer<MainWindow> mainW;
+
currentResult = NoResult;
QFETCH(tst_QShortcut::Action, action);
QFETCH(tst_QShortcut::Widget, testWidget);
@@ -1272,13 +1214,29 @@ void tst_QShortcut::testElement()
QFETCH(int, c4);
QFETCH(tst_QShortcut::Result, result);
- if (action == ClearAll) {
- clearAllShortcuts();
- } else if (action == SetupAccel) {
- setupShortcut(testWidget, txt, k1, k2, k3, k4);
- } else {
- sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4);
- QCOMPARE((int)currentResult, (int)result);
+ if (mainW.isNull()) {
+ mainW.reset(new MainWindow);
+ mainW->setWindowTitle(QTest::currentTestFunction());
+ mainW->show();
+ mainW->activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(mainW.data()));
+ }
+
+ switch (action) {
+ case ClearAll:
+ qDeleteAll(mainW->findChildren<QShortcut *>());
+ break;
+ case SetupAccel:
+ setupShortcut(mainW.data(), txt, testWidget, txt.isEmpty()
+ ? QKeySequence(k1, k2, k3, k4) : QKeySequence::fromString(txt));
+ break;
+ case TestAccel:
+ sendKeyEvents(mainW.data(), k1, c1, k2, c2, k3, c3, k4, c4);
+ QCOMPARE(currentResult, result);
+ break;
+ case TestEnd:
+ mainW.reset();
+ break;
}
}
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index 03bec4286b..02e97e4b4e 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -2,30 +2,34 @@
[normalGeometry]
ubuntu-16.04
[saveRestoreGeometry]
-xcb
+opensuse-leap
+ubuntu-16.04
b2qt
+opensuse-42.3
[restoreVersion1Geometry]
-osx
-[updateWhileMinimized]
ubuntu-16.04
+[updateWhileMinimized]
ubuntu-18.04
rhel-7.4
+ubuntu-16.04
rhel-7.6
-osx
[focusProxyAndInputMethods]
-linux
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+ubuntu-18.04
+rhel-7.4
+opensuse-42.3
[raise]
-# QTBUG-68175
-opensuse
opensuse-leap
-[setWindowGeometry]
-osx
-[windowMoveResize]
-osx
+# QTBUG-68175
+opensuse-42.3
[childEvents]
osx ci
[renderInvisible]
-osx
+osx-10.12
+osx-10.11
+osx-10.14
[optimizedResizeMove]
osx
[optimizedResize_topLevel]
@@ -40,12 +44,14 @@ opensuse
opensuse-leap
[moveInResizeEvent]
ubuntu-16.04
-[moveChild:right]
-osx
-[activateWindow]
-osx-10.12 ci
[multipleToplevelFocusCheck]
-linux
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+ubuntu-18.04
+rhel-7.4
+opensuse-42.3
[windowState]
# QTBUG-75270
winrt
+
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro
index c1908af2a2..d3fbd6d0d9 100644
--- a/tests/auto/widgets/kernel/qwidget/qwidget.pro
+++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro
@@ -16,4 +16,4 @@ mac {
OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm
}
-win32:!winrt: LIBS += -luser32 -lgdi32
+win32:!winrt: QMAKE_USE += user32 gdi32
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index a95d6e76b3..bfc2631842 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -54,6 +54,7 @@
#include <qrandom.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
+#include <QtCore/qoperatingsystemversion.h>
#include <QtGui/qpaintengine.h>
#include <QtGui/qbackingstore.h>
#include <QtGui/qguiapplication.h>
@@ -2527,8 +2528,8 @@ void tst_QWidget::showMinimizedKeepsFocus()
{
if (m_platform == QStringLiteral("xcb"))
QSKIP("QTBUG-26424");
- if (m_platform == QStringLiteral("wayland"))
- QSKIP("Wayland: This fails. Figure out why.");
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported.");
if (m_platform == QStringLiteral("offscreen"))
QSKIP("Platform offscreen does not support showMinimized()");
@@ -2739,8 +2740,8 @@ void tst_QWidget::icon()
void tst_QWidget::hideWhenFocusWidgetIsChild()
{
- if (m_platform == QStringLiteral("wayland"))
- QSKIP("Wayland: This fails. Figure out why.");
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported.");
QScopedPointer<QWidget> testWidget(new QWidget);
testWidget->setWindowTitle(__FUNCTION__);
@@ -5541,8 +5542,8 @@ void tst_QWidget::multipleToplevelFocusCheck()
QSKIP("QTBUG-52974");
#endif
- if (m_platform == QStringLiteral("wayland"))
- QSKIP("Wayland: This fails. Figure out why.");
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
else if (m_platform == QStringLiteral("winrt"))
QSKIP("Winrt: Sometimes crashes in QTextLayout. - QTBUG-68297");
TopLevelFocusCheck w1;
@@ -6256,7 +6257,11 @@ public:
return false;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool nativeEvent(const QByteArray &eventType, void *message, qintptr *) override
+#else
bool nativeEvent(const QByteArray &eventType, void *message, long *) override
+#endif
{
if (isMapNotify(eventType, message))
gotExpectedMapNotify = true;
@@ -6264,7 +6269,11 @@ public:
}
// QAbstractNativeEventFilter interface
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *) override
+#else
bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override
+#endif
{
if (isMapNotify(eventType, message))
gotExpectedGlobalEvent = true;
@@ -7095,7 +7104,7 @@ void tst_QWidget::renderWithPainter()
// Make sure QWidget::render does not modify the render hints set on the painter.
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform
- | QPainter::NonCosmeticDefaultPen | QPainter::TextAntialiasing);
+ | QPainter::TextAntialiasing);
QPainter::RenderHints oldRenderHints = painter.renderHints();
widget.render(&painter);
QCOMPARE(painter.renderHints(), oldRenderHints);
@@ -7693,7 +7702,7 @@ void tst_QWidget::moveWindowInShowEvent()
void tst_QWidget::repaintWhenChildDeleted()
{
#ifdef Q_OS_WIN
- if (QSysInfo::WindowsVersion & QSysInfo::WV_VISTA) {
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::WindowsVista) {
QTest::qWait(1000);
}
#endif
@@ -8064,7 +8073,7 @@ public:
sp.setHeightForWidth(hfwLayout);
QVBoxLayout *vbox = new QVBoxLayout;
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(new ASWidget(sizeHint + QSize(30, 20), sp, false, false));
setLayout(vbox);
}
@@ -8892,7 +8901,7 @@ void tst_QWidget::translucentWidget()
#ifdef Q_OS_WIN
QWidget *desktopWidget = QApplication::desktop()->screen(0);
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::WindowsVista)
widgetSnapshot = grabWindow(desktopWidget->windowHandle(), labelPos.x(), labelPos.y(), label.width(), label.height());
else
#endif
@@ -9674,8 +9683,8 @@ void tst_QWidget::setGraphicsEffect()
void tst_QWidget::activateWindow()
{
- if (m_platform == QStringLiteral("wayland"))
- QSKIP("Wayland: This fails. Figure out why.");
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported.");
// Test case for QTBUG-26711
@@ -9743,8 +9752,8 @@ void tst_QWidget::openModal_taskQTBUG_5804()
void tst_QWidget::focusProxyAndInputMethods()
{
- if (m_platform == QStringLiteral("wayland"))
- QSKIP("Wayland: This fails. Figure out why.");
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported.");
QScopedPointer<QWidget> toplevel(new QWidget(nullptr, Qt::X11BypassWindowManagerHint));
toplevel->setWindowTitle(QLatin1String(QTest::currentTestFunction()));
toplevel->resize(200, 200);
@@ -10111,7 +10120,7 @@ void tst_QWidget::grabMouse()
w.setObjectName(QLatin1String("tst_qwidget_grabMouse"));
w.setWindowTitle(w.objectName());
QLayout *layout = new QVBoxLayout(&w);
- layout->setMargin(50);
+ layout->setContentsMargins(50, 50, 50, 50);
GrabLoggerWidget *grabber = new GrabLoggerWidget(&log, &w);
const QString grabberObjectName = QLatin1String("tst_qwidget_grabMouse_grabber");
grabber->setObjectName(grabberObjectName);
diff --git a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
index 934f2e8025..39d7b695f6 100644
--- a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
@@ -2,7 +2,7 @@
# QTBUG-66345
opensuse-42.3
ubuntu-16.04
-ubuntu-18.04
[setWindowState]
ubuntu-18.04
-rhel
+rhel-7.6
+
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index a552c91928..68e672e16d 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -353,7 +353,10 @@ void tst_QStyle::testWindowsVistaStyle()
QStyle *vistastyle = QStyleFactory::create("WindowsVista");
QVERIFY(testAllFunctions(vistastyle));
- if (QSysInfo::WindowsVersion == QSysInfo::WV_VISTA)
+ if (QOperatingSystemVersion::current().majorVersion()
+ == QOperatingSystemVersion::WindowsVista.majorVersion()
+ && QOperatingSystemVersion::current().minorVersion()
+ == QOperatingSystemVersion::WindowsVista.minorVersion())
testPainting(vistastyle, "vista");
delete vistastyle;
}
diff --git a/tests/auto/widgets/util/qcompleter/BLACKLIST b/tests/auto/widgets/util/qcompleter/BLACKLIST
index fdc424b6ac..367270fdf2 100644
--- a/tests/auto/widgets/util/qcompleter/BLACKLIST
+++ b/tests/auto/widgets/util/qcompleter/BLACKLIST
@@ -1,2 +1,6 @@
[QTBUG_14292_filesystem]
-linux
+ubuntu-16.04
+opensuse-leap
+rhel-7.4
+rhel-6.6
+opensuse-42.3
diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp
index 007825d39c..a17a9f6c33 100644
--- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp
+++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp
@@ -124,13 +124,19 @@ void tst_QAbstractScrollArea::scrollBarWidgets()
QCOMPARE(area.scrollBarWidgets(Qt::AlignTop), QWidgetList());
QCOMPARE(area.scrollBarWidgets(Qt::AlignBottom), w2List);
+ auto sort = [](const QWidgetList l) {
+ QWidgetList list = l;
+ std::sort(list.begin(), list.end());
+ return list;
+ };
+
// two widgets at Bottom.
area.addScrollBarWidget(w3, Qt::AlignBottom);
- QCOMPARE(area.scrollBarWidgets(all).toSet(), allList.toSet());
+ QCOMPARE(sort(area.scrollBarWidgets(all)), sort(allList));
QCOMPARE(area.scrollBarWidgets(Qt::AlignLeft), w1List);
QCOMPARE(area.scrollBarWidgets(Qt::AlignRight), QWidgetList());
QCOMPARE(area.scrollBarWidgets(Qt::AlignTop), QWidgetList());
- QCOMPARE(area.scrollBarWidgets(Qt::AlignBottom).toSet(), (w2List + w3List).toSet());
+ QCOMPARE(sort(area.scrollBarWidgets(Qt::AlignBottom)), sort(w2List + w3List));
//delete
delete w1;
diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
index 1a0d7a9289..f77efe036a 100644
--- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
@@ -33,7 +33,7 @@
#include <QSlider>
#include <QStyle>
#include <QStyleOption>
-#include <QTime>
+#include <QElapsedTimer>
#include <QDebug>
#include <QtTest/private/qtesthelpers_p.h>
@@ -91,7 +91,7 @@ private slots:
void connectedSliders();
private:
- void waitUntilTimeElapsed(const QTime& t, int ms);
+ void waitUntilTimeElapsed(const QElapsedTimer &t, int ms);
QWidget *topLevel;
Slider *slider;
@@ -1662,8 +1662,12 @@ void tst_QAbstractSlider::wheelEvent()
slider->setOrientation(sliderOrientation);
Qt::KeyboardModifier k = withModifiers ? Qt::ControlModifier : Qt::NoModifier;
- QWheelEvent event(slider->rect().bottomRight() + distanceFromBottomRight, WHEEL_DELTA * deltaMultiple,
- Qt::NoButton, k, wheelOrientation);
+
+ const QPoint wheelPoint = slider->rect().bottomRight() + distanceFromBottomRight;
+ const QPoint angleDelta(wheelOrientation == Qt::Horizontal ? WHEEL_DELTA * deltaMultiple : 0,
+ wheelOrientation == Qt::Vertical ? WHEEL_DELTA * deltaMultiple : 0);
+ QWheelEvent event(wheelPoint, slider->mapToGlobal(wheelPoint), QPoint(), angleDelta,
+ Qt::NoButton, k, Qt::NoScrollPhase, false);
QVERIFY(applicationInstance->sendEvent(slider,&event));
#ifdef Q_OS_MAC
QEXPECT_FAIL("Normal data page", "QTBUG-23679", Continue);
@@ -1674,8 +1678,8 @@ void tst_QAbstractSlider::wheelEvent()
slider->setSliderPosition(initialSliderPosition);
k = withModifiers ? Qt::ShiftModifier : Qt::NoModifier;
- event = QWheelEvent(slider->rect().bottomRight() + distanceFromBottomRight, WHEEL_DELTA * deltaMultiple,
- Qt::NoButton, k, wheelOrientation);
+ event = QWheelEvent(wheelPoint, slider->mapToGlobal(wheelPoint), QPoint(), angleDelta,
+ Qt::NoButton, k, Qt::NoScrollPhase, false);
QSignalSpy spy1(slider, SIGNAL(actionTriggered(int)));
QSignalSpy spy2(slider, SIGNAL(valueChanged(int)));
QVERIFY(applicationInstance->sendEvent(slider,&event));
@@ -1715,16 +1719,16 @@ void tst_QAbstractSlider::fineGrainedWheelEvent()
slider->setSliderPosition(0);
const int singleStepDelta = invertedControls ? (-WHEEL_DELTA / 3) : (WHEEL_DELTA / 3);
-
- QWheelEvent eventDown(slider->rect().bottomRight(), singleStepDelta / 2,
- Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ const QPoint wheelPoint = slider->rect().bottomRight();
+ QWheelEvent eventDown(wheelPoint, slider->mapToGlobal(wheelPoint), QPoint(), QPoint(0, singleStepDelta / 2),
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QVERIFY(applicationInstance->sendEvent(slider,&eventDown));
QCOMPARE(slider->sliderPosition(), 0);
QVERIFY(applicationInstance->sendEvent(slider,&eventDown));
QCOMPARE(slider->sliderPosition(), 1);
- QWheelEvent eventUp(slider->rect().bottomRight(), -singleStepDelta / 2,
- Qt::NoButton, Qt::NoModifier, Qt::Vertical);
+ QWheelEvent eventUp(wheelPoint, slider->mapToGlobal(wheelPoint), QPoint(), QPoint(0, -singleStepDelta / 2),
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QVERIFY(applicationInstance->sendEvent(slider,&eventUp));
QCOMPARE(slider->sliderPosition(), 1);
QVERIFY(applicationInstance->sendEvent(slider,&eventUp));
@@ -2053,11 +2057,11 @@ void tst_QAbstractSlider::setValue()
QVERIFY(sliderMovedTimeStamp < valueChangedTimeStamp);
}
-void tst_QAbstractSlider::waitUntilTimeElapsed(const QTime& t, int ms)
+void tst_QAbstractSlider::waitUntilTimeElapsed(const QElapsedTimer &t, int ms)
{
const int eps = 80;
while (t.elapsed() < ms + eps)
- QTest::qWait(qMax(ms - t.elapsed() + eps, 25));
+ QTest::qWait(qMax(int(ms - t.elapsed() + eps), 25));
}
void tst_QAbstractSlider::setRepeatAction()
@@ -2073,7 +2077,7 @@ void tst_QAbstractSlider::setRepeatAction()
QCOMPARE(spy.count(), 0);
QCOMPARE(slider->value(), 55);
- QTime t;
+ QElapsedTimer t;
t.start();
QTest::qWait(300);
QCOMPARE(spy.count(), 0);
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index a576770811..4e16edaca8 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -254,12 +254,22 @@ void tst_QComboBox::getSetCheck()
obj1.setMaxCount(INT_MAX);
QCOMPARE(INT_MAX, obj1.maxCount());
+ // QCompleter *QComboBox::completer()
+ // void QComboBox::setCompleter(QCompleter *)
+ obj1.setCompleter(nullptr);
+ QCOMPARE(nullptr, obj1.completer());
+ QCompleter completer;
+ obj1.setCompleter(&completer);
+ QVERIFY(obj1.completer() == nullptr); // no QLineEdit is set
+
+#if QT_DEPRECATED_SINCE(5, 13)
// bool QComboBox::autoCompletion()
// void QComboBox::setAutoCompletion(bool)
obj1.setAutoCompletion(false);
QCOMPARE(false, obj1.autoCompletion());
obj1.setAutoCompletion(true);
QCOMPARE(true, obj1.autoCompletion());
+#endif
// bool QComboBox::duplicatesEnabled()
// void QComboBox::setDuplicatesEnabled(bool)
@@ -317,6 +327,9 @@ void tst_QComboBox::getSetCheck()
QCOMPARE(var8, obj1.lineEdit());
// delete var8; // No delete, since QComboBox takes ownership
+ // After setting a line edit, completer() should not return nullptr anymore
+ QVERIFY(obj1.completer() != nullptr);
+
// const QValidator * QComboBox::validator()
// void QComboBox::setValidator(const QValidator *)
QIntValidator *var9 = new QIntValidator(0);
@@ -777,7 +790,9 @@ void tst_QComboBox::virtualAutocompletion()
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
QComboBox *testWidget = topLevel.comboBox();
testWidget->clear();
+#if QT_DEPRECATED_SINCE(5, 13)
testWidget->setAutoCompletion(true);
+#endif
testWidget->addItem("Foo");
testWidget->addItem("Bar");
testWidget->addItem("Boat");
@@ -837,7 +852,9 @@ void tst_QComboBox::autoCompletionCaseSensitivity()
QCOMPARE(qApp->focusWidget(), (QWidget *)testWidget);
testWidget->clear();
+#if QT_DEPRECATED_SINCE(5, 13)
testWidget->setAutoCompletion(true);
+#endif
testWidget->addItem("Cow");
testWidget->addItem("irrelevant1");
testWidget->addItem("aww");
@@ -2102,7 +2119,9 @@ void tst_QComboBox::mouseWheel()
box.setEditable(i==0?false:true);
box.setCurrentIndex(startIndex);
- QWheelEvent event = QWheelEvent(box.rect().bottomRight() , WHEEL_DELTA * wheelDirection, Qt::NoButton, Qt::NoModifier);
+ const QPoint wheelPoint = box.rect().bottomRight();
+ QWheelEvent event(wheelPoint, box.mapToGlobal(wheelPoint), QPoint(), QPoint(0, WHEEL_DELTA * wheelDirection),
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QVERIFY(applicationInstance->sendEvent(&box,&event));
QCOMPARE(box.currentIndex(), expectedIndex);
@@ -2131,7 +2150,9 @@ void tst_QComboBox::popupWheelHandling()
comboBox->showPopup();
QTRY_VERIFY(comboBox->view() && comboBox->view()->isVisible());
const QPoint popupPos = comboBox->view()->pos();
- QWheelEvent event(QPointF(10, 10), WHEEL_DELTA, Qt::NoButton, Qt::NoModifier);
+ const QPoint wheelPoint(10, 10);
+ QWheelEvent event(wheelPoint, scrollArea.mapToGlobal(wheelPoint), QPoint(), QPoint(0, WHEEL_DELTA),
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
QVERIFY(QCoreApplication::sendEvent(scrollArea.windowHandle(), &event));
QCoreApplication::processEvents();
QVERIFY(comboBox->view()->isVisible());
@@ -3050,7 +3071,9 @@ void tst_QComboBox::task_QTBUG_31146_popupCompletion()
{
QComboBox comboBox;
comboBox.setEditable(true);
+#if QT_DEPRECATED_SINCE(5, 13)
comboBox.setAutoCompletion(true);
+#endif
comboBox.setInsertPolicy(QComboBox::NoInsert);
comboBox.completer()->setCaseSensitivity(Qt::CaseInsensitive);
comboBox.completer()->setCompletionMode(QCompleter::PopupCompletion);
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index b5ef454b14..810f081b73 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -307,19 +307,19 @@ static QLatin1String modifierToName(Qt::KeyboardModifier modifier)
{
switch (modifier) {
case Qt::NoModifier:
- return QLatin1Literal("No");
+ return QLatin1String("No");
break;
case Qt::ControlModifier:
- return QLatin1Literal("Ctrl");
+ return QLatin1String("Ctrl");
break;
case Qt::ShiftModifier:
- return QLatin1Literal("Shift");
+ return QLatin1String("Shift");
break;
case Qt::AltModifier:
- return QLatin1Literal("Alt");
+ return QLatin1String("Alt");
break;
case Qt::MetaModifier:
- return QLatin1Literal("Meta");
+ return QLatin1String("Meta");
break;
default:
qFatal("Unexpected keyboard modifier");
@@ -331,17 +331,17 @@ static QLatin1String sectionToName(const QDateTimeEdit::Section section)
{
switch (section) {
case QDateTimeEdit::SecondSection:
- return QLatin1Literal("Second");
+ return QLatin1String("Second");
case QDateTimeEdit::MinuteSection:
- return QLatin1Literal("Minute");
+ return QLatin1String("Minute");
case QDateTimeEdit::HourSection:
- return QLatin1Literal("Hours");
+ return QLatin1String("Hours");
case QDateTimeEdit::DaySection:
- return QLatin1Literal("Day");
+ return QLatin1String("Day");
case QDateTimeEdit::MonthSection:
- return QLatin1Literal("Month");
+ return QLatin1String("Month");
case QDateTimeEdit::YearSection:
- return QLatin1Literal("Year");
+ return QLatin1String("Year");
default:
qFatal("Unexpected section");
return QLatin1String();
@@ -3141,7 +3141,6 @@ void tst_QDateTimeEdit::wheelEvent_data()
{
#if QT_CONFIG(wheelevent)
QTest::addColumn<QPoint>("angleDelta");
- QTest::addColumn<int>("qt4Delta");
QTest::addColumn<int>("stepModifier");
QTest::addColumn<Qt::KeyboardModifiers>("modifiers");
QTest::addColumn<Qt::MouseEventSource>("source");
@@ -3217,16 +3216,16 @@ void tst_QDateTimeEdit::wheelEvent_data()
QLatin1String sourceName;
switch (source) {
case Qt::MouseEventNotSynthesized:
- sourceName = QLatin1Literal("NotSynthesized");
+ sourceName = QLatin1String("NotSynthesized");
break;
case Qt::MouseEventSynthesizedBySystem:
- sourceName = QLatin1Literal("SynthesizedBySystem");
+ sourceName = QLatin1String("SynthesizedBySystem");
break;
case Qt::MouseEventSynthesizedByQt:
- sourceName = QLatin1Literal("SynthesizedByQt");
+ sourceName = QLatin1String("SynthesizedByQt");
break;
case Qt::MouseEventSynthesizedByApplication:
- sourceName = QLatin1Literal("SynthesizedByApplication");
+ sourceName = QLatin1String("SynthesizedByApplication");
break;
default:
qFatal("Unexpected wheel event source");
@@ -3255,7 +3254,6 @@ void tst_QDateTimeEdit::wheelEvent_data()
modifierName.latin1(),
sourceName.latin1())
<< angleDelta
- << units
<< static_cast<int>(stepModifier)
<< modifiers
<< source
@@ -3277,7 +3275,6 @@ void tst_QDateTimeEdit::wheelEvent()
{
#if QT_CONFIG(wheelevent)
QFETCH(QPoint, angleDelta);
- QFETCH(int, qt4Delta);
QFETCH(int, stepModifier);
QFETCH(Qt::KeyboardModifiers, modifiers);
QFETCH(Qt::MouseEventSource, source);
@@ -3294,9 +3291,8 @@ void tst_QDateTimeEdit::wheelEvent()
style->stepModifier = static_cast<Qt::KeyboardModifier>(stepModifier);
edit.setStyle(style.data());
- QWheelEvent event(QPointF(), QPointF(), QPoint(), angleDelta, qt4Delta,
- Qt::Vertical, Qt::NoButton, modifiers, Qt::NoScrollPhase,
- source);
+ QWheelEvent event(QPointF(), QPointF(), QPoint(), angleDelta,
+ Qt::NoButton, modifiers, Qt::NoScrollPhase, false, source);
QCOMPARE(edit.date(), startDate);
for (QDate expected : expectedDates) {
@@ -3454,7 +3450,7 @@ void tst_QDateTimeEdit::timeSpec()
}
QVERIFY(edit.minimumTime() != min.time());
QVERIFY(edit.minimumDateTime().timeSpec() != min.timeSpec());
- QCOMPARE(edit.minimumDateTime().toTime_t(), min.toTime_t());
+ QCOMPARE(edit.minimumDateTime().toSecsSinceEpoch(), min.toSecsSinceEpoch());
} else {
QSKIP("Not tested in the GMT timezone");
}
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index f8ce6a2c0a..625116654d 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -670,7 +670,11 @@ void tst_QDockWidget::dockLocationChanged()
spy.clear();
dw.setFloating(true);
- QTest::qWait(100);
+ QTRY_COMPARE(spy.count(), 1);
+ QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
+ Qt::NoDockWidgetArea);
+ spy.clear();
+
dw.setFloating(false);
QTRY_COMPARE(spy.count(), 1);
QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)),
diff --git a/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST b/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST
index c1b6c9693e..8f5648d0f9 100644
--- a/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST
+++ b/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST
@@ -1,2 +1,4 @@
[editingFinished]
-*
+osx-10.12
+osx-10.14
+osx-10.13
diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
index 954ee6471d..c760d9cc99 100644
--- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -221,19 +221,19 @@ static QLatin1String modifierToName(Qt::KeyboardModifier modifier)
{
switch (modifier) {
case Qt::NoModifier:
- return QLatin1Literal("No");
+ return QLatin1String("No");
break;
case Qt::ControlModifier:
- return QLatin1Literal("Ctrl");
+ return QLatin1String("Ctrl");
break;
case Qt::ShiftModifier:
- return QLatin1Literal("Shift");
+ return QLatin1String("Shift");
break;
case Qt::AltModifier:
- return QLatin1Literal("Alt");
+ return QLatin1String("Alt");
break;
case Qt::MetaModifier:
- return QLatin1Literal("Meta");
+ return QLatin1String("Meta");
break;
default:
qFatal("Unexpected keyboard modifier");
@@ -1377,7 +1377,6 @@ void tst_QDoubleSpinBox::wheelEvents_data()
{
#if QT_CONFIG(wheelevent)
QTest::addColumn<QPoint>("angleDelta");
- QTest::addColumn<int>("qt4Delta");
QTest::addColumn<int>("stepModifier");
QTest::addColumn<Qt::KeyboardModifiers>("modifier");
QTest::addColumn<Qt::MouseEventSource>("source");
@@ -1448,16 +1447,16 @@ void tst_QDoubleSpinBox::wheelEvents_data()
QLatin1String sourceName;
switch (source) {
case Qt::MouseEventNotSynthesized:
- sourceName = QLatin1Literal("NotSynthesized");
+ sourceName = QLatin1String("NotSynthesized");
break;
case Qt::MouseEventSynthesizedBySystem:
- sourceName = QLatin1Literal("SynthesizedBySystem");
+ sourceName = QLatin1String("SynthesizedBySystem");
break;
case Qt::MouseEventSynthesizedByQt:
- sourceName = QLatin1Literal("SynthesizedByQt");
+ sourceName = QLatin1String("SynthesizedByQt");
break;
case Qt::MouseEventSynthesizedByApplication:
- sourceName = QLatin1Literal("SynthesizedByApplication");
+ sourceName = QLatin1String("SynthesizedByApplication");
break;
default:
qFatal("Unexpected wheel event source");
@@ -1476,7 +1475,6 @@ void tst_QDoubleSpinBox::wheelEvents_data()
modifierName.latin1(),
sourceName.latin1())
<< angleDelta
- << units
<< static_cast<int>(stepModifier)
<< modifiers
<< source
@@ -1496,7 +1494,6 @@ void tst_QDoubleSpinBox::wheelEvents()
{
#if QT_CONFIG(wheelevent)
QFETCH(QPoint, angleDelta);
- QFETCH(int, qt4Delta);
QFETCH(int, stepModifier);
QFETCH(Qt::KeyboardModifiers, modifier);
QFETCH(Qt::MouseEventSource, source);
@@ -1512,9 +1509,8 @@ void tst_QDoubleSpinBox::wheelEvents()
style->stepModifier = static_cast<Qt::KeyboardModifier>(stepModifier);
spinBox.setStyle(style.data());
- QWheelEvent event(QPointF(), QPointF(), QPoint(), angleDelta, qt4Delta,
- Qt::Vertical, Qt::NoButton, modifier, Qt::NoScrollPhase,
- source);
+ QWheelEvent event(QPointF(), QPointF(), QPoint(), angleDelta,
+ Qt::NoButton, modifier, Qt::NoScrollPhase, false, source);
for (int expected : expectedValues) {
qApp->sendEvent(&spinBox, &event);
QCOMPARE(spinBox.value(), expected);
diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
index 1813e5ad5f..5392d36ae0 100644
--- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
+++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
@@ -108,7 +108,7 @@ void tst_QFontComboBox::currentFont()
QFont oldCurrentFont = box.currentFont();
box.setCurrentFont(currentFont);
- QRegExp foundry(" \\[.*\\]");
+ QRegularExpression foundry(" \\[.*\\]");
if (!box.currentFont().family().contains(foundry)) {
QCOMPARE(box.currentFont(), currentFont);
}
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index 34862f6810..f599ac73c6 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -461,7 +461,7 @@ void tst_QLabel::unicodeText()
QVBoxLayout *layout = new QVBoxLayout();
QLabel *label = new QLabel(text, &frame);
layout->addWidget(label);
- layout->setMargin(8);
+ layout->setContentsMargins(8, 8, 8, 8);
frame.setLayout(layout);
frame.show();
QVERIFY(QTest::qWaitForWindowExposed(&frame));
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 95799905de..1c68a5f752 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -3530,6 +3530,13 @@ void tst_QLineEdit::textMargin()
centerOnScreen(&tlw);
tlw.show();
+ const QMargins margins = testWidget.textMargins();
+ QCOMPARE(left, margins.left());
+ QCOMPARE(top, margins.top());
+ QCOMPARE(right, margins.right());
+ QCOMPARE(bottom, margins.bottom());
+
+#if QT_DEPRECATED_SINCE(5, 14)
int l;
int t;
int r;
@@ -3539,6 +3546,7 @@ void tst_QLineEdit::textMargin()
QCOMPARE(top, t);
QCOMPARE(right, r);
QCOMPARE(bottom, b);
+#endif
QTest::mouseClick(&testWidget, Qt::LeftButton, 0, mousePressPos);
QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition);
@@ -3615,6 +3623,14 @@ void tst_QLineEdit::task174640_editingFinished()
le2->setFocus();
QTRY_VERIFY(le2->hasFocus());
+ // editingFinished will not be emitted anew because no editing happened
+ QCOMPARE(editingFinishedSpy.count(), 0);
+
+ le1->setFocus();
+ QTRY_VERIFY(le1->hasFocus());
+ QTest::keyPress(le1, Qt::Key_Plus);
+ le2->setFocus();
+ QTRY_VERIFY(le2->hasFocus());
QCOMPARE(editingFinishedSpy.count(), 1);
editingFinishedSpy.clear();
@@ -3632,6 +3648,8 @@ void tst_QLineEdit::task174640_editingFinished()
delete testMenu1;
QCOMPARE(editingFinishedSpy.count(), 0);
QTRY_VERIFY(le1->hasFocus());
+ // Ensure le1 has been edited
+ QTest::keyPress(le1, Qt::Key_Plus);
QMenu *testMenu2 = new QMenu(le2);
testMenu2->addAction("foo2");
@@ -3986,7 +4004,7 @@ void tst_QLineEdit::QTBUG7174_inputMaskCursorBlink()
edit.setFocus();
edit.setText(QLatin1String("AAAA"));
edit.show();
- QRect cursorRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QRect cursorRect = edit.inputMethodQuery(Qt::ImCursorRectangle).toRect();
QVERIFY(QTest::qWaitForWindowExposed(&edit));
edit.updateRegion = QRegion();
QTest::qWait(QApplication::cursorFlashTime());
diff --git a/tests/auto/widgets/widgets/qmdiarea/BLACKLIST b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST
index b1c8d7dfde..1dd876ea97 100644
--- a/tests/auto/widgets/widgets/qmdiarea/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST
@@ -1,7 +1,16 @@
-[updateScrollBars]
-osx
[tileSubWindows]
-osx
-xcb
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+osx-10.11
+osx-10.13
+ubuntu-18.04
+osx-10.14
+rhel-7.4
+osx-10.12
+opensuse-42.3
[resizeTimer]
-osx
+osx-10.12
+osx-10.14
+osx-10.13
+
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 67b79e3faf..b8abd78657 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -333,6 +333,7 @@ void tst_QMdiArea::subWindowActivated()
for ( i = 0; i < count; ++i ) {
QWidget *widget = new QWidget(workspace, 0);
widget->setAttribute(Qt::WA_DeleteOnClose);
+ widget->setFocus();
workspace->addSubWindow(widget)->show();
widget->show();
qApp->processEvents();
@@ -879,7 +880,7 @@ void tst_QMdiArea::minimumSizeHint()
{
QMdiArea workspace;
workspace.show();
- QSize expectedSize(workspace.style()->pixelMetric(QStyle::PM_MDIMinimizedWidth),
+ QSize expectedSize(workspace.style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth),
workspace.style()->pixelMetric(QStyle::PM_TitleBarHeight));
qApp->processEvents();
QAbstractScrollArea dummyScrollArea;
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST b/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST
deleted file mode 100644
index 26d1776b0d..0000000000
--- a/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[setOpaqueResizeAndMove]
-osx-10.12
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
index 2b59a227b3..b8891fab95 100644
--- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -613,7 +613,7 @@ void tst_QMdiSubWindow::showShaded()
// Calculate mouse position for bottom right corner and simulate a
// vertical resize with the mouse.
- int offset = window->style()->pixelMetric(QStyle::PM_MDIFrameWidth) / 2;
+ int offset = window->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth) / 2;
QPoint mousePosition(window->width() - qMax(offset, 2), window->height() - qMax(offset, 2));
QWidget *mouseReceiver = nullptr;
#ifdef Q_OS_MAC
@@ -759,7 +759,7 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove()
QTRY_COMPARE(priv->resizeTimerId, -1);
// Enter resize mode.
- int offset = window->style()->pixelMetric(QStyle::PM_MDIFrameWidth) / 2;
+ int offset = window->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth) / 2;
QPoint mousePosition(mouseReceiver->width() - qMax(offset, 2), mouseReceiver->height() - qMax(offset, 2));
sendMouseMove(mouseReceiver, mousePosition, Qt::NoButton);
sendMousePress(mouseReceiver, mousePosition);
@@ -1762,7 +1762,8 @@ void tst_QMdiSubWindow::fixedMinMaxSize()
int minimizedHeight = subWindow->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
if (!subWindow->style()->styleHint(QStyle::SH_TitleBar_NoBorder, &options, subWindow))
minimizedHeight += 8;
- int minimizedWidth = subWindow->style()->pixelMetric(QStyle::PM_MDIMinimizedWidth, &options);
+ int minimizedWidth = subWindow->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth,
+ &options);
const QSize minimizedSize = QSize(minimizedWidth, minimizedHeight);
// Even though the sub window has a minimum size set, it should be possible
diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST
index bac14ea225..ad6d2f340c 100644
--- a/tests/auto/widgets/widgets/qmenu/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST
@@ -1,13 +1,13 @@
[task258920_mouseBorder]
-osx
-[submenuTearOffDontClose]
-osx-10.12 ci
+osx-10.14
+osx-10.13
[layoutDirection]
+osx-10.12
+osx-10.13
# Fails when enabling synchronous expose events QTBUG-62092
-osx ci
[pushButtonPopulateOnAboutToShow]
-osx
+osx-10.13
[tearOff]
-osx
+osx-10.14
[activeSubMenuPosition]
winrt
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 3bfbe754ef..9c40c0bd57 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -610,7 +610,7 @@ void tst_QMenu::widgetActionFocus()
static QMenu *getTornOffMenu()
{
- foreach (QWidget *w, QApplication::allWidgets()) {
+ for (QWidget *w : QApplication::allWidgets()) {
if (w->isVisible() && w->inherits("QTornOffMenu"))
return static_cast<QMenu *>(w);
}
@@ -948,30 +948,28 @@ void tst_QMenu::menuSizeHint()
{
QMenu menu;
//this is a list of arbitrary strings so that we check the geometry
- QStringList list = QStringList() << "trer" << "ezrfgtgvqd" << "sdgzgzerzerzer" << "eerzertz" << "er";
- foreach (QString str, list)
+ for (auto str : {"trer", "ezrfgtgvqd", "sdgzgzerzerzer", "eerzertz", "er"})
menu.addAction(str);
- int left, top, right, bottom;
- menu.getContentsMargins(&left, &top, &right, &bottom);
+ const QMargins cm = menu.contentsMargins();
const int panelWidth = menu.style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, &menu);
const int hmargin = menu.style()->pixelMetric(QStyle::PM_MenuHMargin, 0, &menu),
vmargin = menu.style()->pixelMetric(QStyle::PM_MenuVMargin, 0, &menu);
int maxWidth =0;
QRect result;
- foreach (QAction *action, menu.actions()) {
+ for (QAction *action : menu.actions()) {
maxWidth = qMax(maxWidth, menu.actionGeometry(action).width());
result |= menu.actionGeometry(action);
- QCOMPARE(result.x(), left + hmargin + panelWidth);
- QCOMPARE(result.y(), top + vmargin + panelWidth);
+ QCOMPARE(result.x(), cm.left() + hmargin + panelWidth);
+ QCOMPARE(result.y(), cm.top() + vmargin + panelWidth);
}
QStyleOption opt(0);
opt.rect = menu.rect();
opt.state = QStyle::State_None;
- QSize resSize = QSize(result.x(), result.y()) + result.size() + QSize(hmargin + right + panelWidth, vmargin + top + panelWidth);
+ QSize resSize = QSize(result.x(), result.y()) + result.size() + QSize(hmargin + cm.right() + panelWidth, vmargin + cm.top() + panelWidth);
resSize = menu.style()->sizeFromContents(QStyle::CT_Menu, &opt,
resSize.expandedTo(QApplication::globalStrut()), &menu);
@@ -1572,8 +1570,7 @@ void tst_QMenu::menuSize_Scrolling()
int hmargin = style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr, this);
int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr, this);
- int leftMargin, topMargin, rightMargin, bottomMargin;
- getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
+ const QMargins cm = contentsMargins();
QRect lastItem = actionGeometry(actions().at(actions().length() - 1));
QSize s = size();
#ifdef Q_OS_WINRT
@@ -1586,7 +1583,7 @@ void tst_QMenu::menuSize_Scrolling()
return;
}
- QCOMPARE( s.width(), lastItem.right() + fw + hmargin + rightMargin + 1);
+ QCOMPARE( s.width(), lastItem.right() + fw + hmargin + cm.right() + 1);
QMenu::showEvent(e);
}
diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
index f897797f00..c9e15e531c 100644
--- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
@@ -3,6 +3,6 @@ ubuntu-16.04
#QTBUG-66255
ubuntu-18.04
[activatedCount]
-*
+opensuse-42.3
[QTBUG_65488_hiddenActionTriggered]
winrt
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index cb829c81a6..d6ba85d61f 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -113,10 +113,7 @@ private slots:
void check_escKey();
#endif
-#ifndef Q_OS_WINCE
void allowActiveAndDisabled();
-#endif
-
void taskQTBUG56860_focus();
void check_endKey();
void check_homeKey();
diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST
index b67c8354e8..b281eca3bf 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST
+++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST
@@ -1,5 +1,3 @@
-[clearAndGrab]
-ubuntu
-
[stackWidgetOpaqueChildIsVisible]
-windows
+windows-10 msvc-2017
+
diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
index df5ff9d448..3408fc0946 100644
--- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
@@ -174,7 +174,7 @@ void tst_QProgressBar::format()
#ifndef Q_OS_MAC
// Animated scroll bars get paint events all the time
#ifdef Q_OS_WIN
- if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA)
+ if (QOperatingSystemVersion::current() < QOperatingSystemVersion::WindowsVista)
#endif
QVERIFY(!bar.repainted);
#endif
diff --git a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
index d1923e4bb0..9f08bd337b 100644
--- a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
+++ b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp
@@ -87,7 +87,7 @@ public:
protected:
QVariant inputMethodQuery(Qt::InputMethodQuery query) const
{
- if (query == Qt::ImMicroFocus)
+ if (query == Qt::ImCursorRectangle)
return QRect(width() / 2, height() / 2, 5, 5);
return QWidget::inputMethodQuery(query);
}
@@ -110,7 +110,7 @@ void tst_QScrollArea::ensureMicroFocusVisible_Task_167838()
parent->resize(300, 300);
scrollArea.setWidget(parent);
scrollArea.ensureWidgetVisible(child, 10, 10);
- QRect microFocus = child->inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QRect microFocus = child->inputMethodQuery(Qt::ImCursorRectangle).toRect();
QPoint p = child->mapTo(scrollArea.viewport(), microFocus.topLeft());
microFocus.translate(p - microFocus.topLeft());
QVERIFY(scrollArea.viewport()->rect().contains(microFocus));
diff --git a/tests/auto/widgets/widgets/qscrollbar/BLACKLIST b/tests/auto/widgets/widgets/qscrollbar/BLACKLIST
deleted file mode 100644
index 277ae4d260..0000000000
--- a/tests/auto/widgets/widgets/qscrollbar/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-#QTBUG-66321
-[QTBUG_42871]
-macos
diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
index 278f5cdd68..339ff293f4 100644
--- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
+++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp
@@ -151,8 +151,11 @@ void tst_QScrollBar::QTBUG_27308()
testWidget.setValue(testWidget.minimum());
testWidget.setEnabled(false);
- QWheelEvent event(testWidget.rect().center(),
- -WHEEL_DELTA, Qt::NoButton, Qt::NoModifier, testWidget.orientation());
+ const QPoint wheelPoint = testWidget.rect().center();
+ const QPoint angleDelta(testWidget.orientation() == Qt::Horizontal ? -WHEEL_DELTA : 0,
+ testWidget.orientation() == Qt::Vertical ? -WHEEL_DELTA : 0);
+ QWheelEvent event(wheelPoint, testWidget.mapToGlobal(wheelPoint), QPoint(), angleDelta,
+ Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false);
qApp->sendEvent(&testWidget, &event);
QCOMPARE(testWidget.value(), testWidget.minimum());
}
diff --git a/tests/auto/widgets/widgets/qspinbox/BLACKLIST b/tests/auto/widgets/widgets/qspinbox/BLACKLIST
index a38511bfb4..96a7732165 100644
--- a/tests/auto/widgets/widgets/qspinbox/BLACKLIST
+++ b/tests/auto/widgets/widgets/qspinbox/BLACKLIST
@@ -1,3 +1,2 @@
[stepModifierPressAndHold]
-opensuse ci # QTBUG-69492
-opensuse-leap ci
+opensuse-42.3
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index 52d7dad7cf..d75e701d1c 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -206,7 +206,7 @@ private slots:
void stepModifierPressAndHold_data();
void stepModifierPressAndHold();
public slots:
- void valueChangedHelper(const QString &);
+ void textChangedHelper(const QString &);
void valueChangedHelper(int);
private:
QStringList actualTexts;
@@ -222,19 +222,19 @@ static QLatin1String modifierToName(Qt::KeyboardModifier modifier)
{
switch (modifier) {
case Qt::NoModifier:
- return QLatin1Literal("No");
+ return QLatin1String("No");
break;
case Qt::ControlModifier:
- return QLatin1Literal("Ctrl");
+ return QLatin1String("Ctrl");
break;
case Qt::ShiftModifier:
- return QLatin1Literal("Shift");
+ return QLatin1String("Shift");
break;
case Qt::AltModifier:
- return QLatin1Literal("Alt");
+ return QLatin1String("Alt");
break;
case Qt::MetaModifier:
- return QLatin1Literal("Meta");
+ return QLatin1String("Meta");
break;
default:
qFatal("Unexpected keyboard modifier");
@@ -490,7 +490,7 @@ void tst_QSpinBox::setPrefixSuffix()
}
}
-void tst_QSpinBox::valueChangedHelper(const QString &text)
+void tst_QSpinBox::textChangedHelper(const QString &text)
{
actualTexts << text;
}
@@ -568,7 +568,7 @@ void tst_QSpinBox::setTracking()
QSpinBox spin(0);
spin.setKeyboardTracking(tracking);
spin.show();
- connect(&spin, SIGNAL(valueChanged(QString)), this, SLOT(valueChangedHelper(QString)));
+ connect(&spin, &QSpinBox::textChanged, this, &tst_QSpinBox::textChangedHelper);
keys.simulate(&spin);
QCOMPARE(actualTexts, texts);
@@ -1331,7 +1331,6 @@ void tst_QSpinBox::wheelEvents_data()
{
#if QT_CONFIG(wheelevent)
QTest::addColumn<QPoint>("angleDelta");
- QTest::addColumn<int>("qt4Delta");
QTest::addColumn<int>("stepModifier");
QTest::addColumn<Qt::KeyboardModifiers>("modifier");
QTest::addColumn<Qt::MouseEventSource>("source");
@@ -1402,16 +1401,16 @@ void tst_QSpinBox::wheelEvents_data()
QLatin1String sourceName;
switch (source) {
case Qt::MouseEventNotSynthesized:
- sourceName = QLatin1Literal("NotSynthesized");
+ sourceName = QLatin1String("NotSynthesized");
break;
case Qt::MouseEventSynthesizedBySystem:
- sourceName = QLatin1Literal("SynthesizedBySystem");
+ sourceName = QLatin1String("SynthesizedBySystem");
break;
case Qt::MouseEventSynthesizedByQt:
- sourceName = QLatin1Literal("SynthesizedByQt");
+ sourceName = QLatin1String("SynthesizedByQt");
break;
case Qt::MouseEventSynthesizedByApplication:
- sourceName = QLatin1Literal("SynthesizedByApplication");
+ sourceName = QLatin1String("SynthesizedByApplication");
break;
default:
qFatal("Unexpected wheel event source");
@@ -1430,7 +1429,6 @@ void tst_QSpinBox::wheelEvents_data()
modifierName.latin1(),
sourceName.latin1())
<< angleDelta
- << units
<< static_cast<int>(stepModifier)
<< modifiers
<< source
@@ -1450,7 +1448,6 @@ void tst_QSpinBox::wheelEvents()
{
#if QT_CONFIG(wheelevent)
QFETCH(QPoint, angleDelta);
- QFETCH(int, qt4Delta);
QFETCH(int, stepModifier);
QFETCH(Qt::KeyboardModifiers, modifier);
QFETCH(Qt::MouseEventSource, source);
@@ -1466,9 +1463,8 @@ void tst_QSpinBox::wheelEvents()
style->stepModifier = static_cast<Qt::KeyboardModifier>(stepModifier);
spinBox.setStyle(style.data());
- QWheelEvent event(QPointF(), QPointF(), QPoint(), angleDelta, qt4Delta,
- Qt::Vertical, Qt::NoButton, modifier, Qt::NoScrollPhase,
- source);
+ QWheelEvent event(QPointF(), QPointF(), QPoint(), angleDelta,
+ Qt::NoButton, modifier, Qt::NoScrollPhase, false, source);
for (int expected : expectedValues) {
qApp->sendEvent(&spinBox, &event);
QCOMPARE(spinBox.value(), expected);
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index 8b45ac20b7..cbeb77a25e 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -599,7 +599,7 @@ void tst_QSplitter::testShowHide()
QWidget widget(&topLevel);
widget.resize(400 + split->handleWidth(), 200);
QVBoxLayout *lay=new QVBoxLayout(&widget);
- lay->setMargin(0);
+ lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(0);
split->addWidget(new QWidget);
split->addWidget(new QWidget);
diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro
index 6523209c32..b61cc8fa13 100644
--- a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro
+++ b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro
@@ -8,4 +8,4 @@ INCLUDEPATH += ../
HEADERS +=
SOURCES += tst_qtabwidget.cpp
-win32:!winrt: LIBS += -luser32
+win32:!winrt: QMAKE_USE += user32
diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
index cbf5196bb9..feade7d443 100644
--- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
@@ -620,7 +620,7 @@ void tst_QTabWidget::heightForWidth()
QWidget *window = new QWidget;
QVBoxLayout *lay = new QVBoxLayout(window);
- lay->setMargin(0);
+ lay->setContentsMargins(0, 0, 0, 0);
lay->setSpacing(0);
QTabWidget *tabWid = new QTabWidget(window);
QWidget *w = new QWidget;
@@ -637,7 +637,7 @@ void tst_QTabWidget::heightForWidth()
);
label->setWordWrap(true);
lay2->addWidget(label);
- lay2->setMargin(0);
+ lay2->setContentsMargins(0, 0, 0, 0);
lay->addWidget(tabWid);
int h = window->heightForWidth(160);
diff --git a/tests/auto/widgets/widgets/qtextbrowser/heading.html b/tests/auto/widgets/widgets/qtextbrowser/heading.html
new file mode 100644
index 0000000000..8b23807f65
--- /dev/null
+++ b/tests/auto/widgets/widgets/qtextbrowser/heading.html
@@ -0,0 +1,2 @@
+<h3>this is a heading</h3>
+<p>this is a paragraph</p>
diff --git a/tests/auto/widgets/widgets/qtextbrowser/markdown.md b/tests/auto/widgets/widgets/qtextbrowser/markdown.md
new file mode 100644
index 0000000000..be56aef234
--- /dev/null
+++ b/tests/auto/widgets/widgets/qtextbrowser/markdown.md
@@ -0,0 +1,2 @@
+### this is a heading
+this is a paragraph
diff --git a/tests/auto/widgets/widgets/qtextbrowser/markdown.really b/tests/auto/widgets/widgets/qtextbrowser/markdown.really
new file mode 100644
index 0000000000..be56aef234
--- /dev/null
+++ b/tests/auto/widgets/widgets/qtextbrowser/markdown.really
@@ -0,0 +1,2 @@
+### this is a heading
+this is a paragraph
diff --git a/tests/auto/widgets/widgets/qtextbrowser/qtextbrowser.pro b/tests/auto/widgets/widgets/qtextbrowser/qtextbrowser.pro
index 9680ffd871..dfdcf26497 100644
--- a/tests/auto/widgets/widgets/qtextbrowser/qtextbrowser.pro
+++ b/tests/auto/widgets/widgets/qtextbrowser/qtextbrowser.pro
@@ -4,6 +4,6 @@ SOURCES += tst_qtextbrowser.cpp
QT += widgets testlib
-TESTDATA += *.html subdir/*
+TESTDATA += *.html *.md markdown.really subdir/*
builtin_testdata: DEFINES += BUILTIN_TESTDATA
diff --git a/tests/auto/widgets/widgets/qtextbrowser/quotesAndFractions.md b/tests/auto/widgets/widgets/qtextbrowser/quotesAndFractions.md
new file mode 100644
index 0000000000..6bad9cb95b
--- /dev/null
+++ b/tests/auto/widgets/widgets/qtextbrowser/quotesAndFractions.md
@@ -0,0 +1 @@
+you’ll hope to see ❝quotes❞ ﹠1½ ⅔ ¼ ⅗ ⅚ ⅝ some “vulgar” fractions (pardon my «French»)
diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp
index 8a1b228c71..27bf0ce7be 100644
--- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp
+++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -38,7 +38,7 @@
class TestBrowser : public QTextBrowser
{
public:
- inline TestBrowser() : htmlLoadAttempts(0) {
+ inline TestBrowser() {
show();
QApplication::setActiveWindow(this);
activateWindow();
@@ -47,11 +47,12 @@ public:
QVERIFY(hasFocus());
}
- virtual QVariant loadResource(int type, const QUrl &name);
+ QVariant loadResource(int type, const QUrl &name) override;
- int htmlLoadAttempts;
+ int htmlLoadAttempts = 0;
QUrl lastResource;
QUrl sourceInsideLoadResource;
+ QUrl baseInsideLoadResource;
};
QVariant TestBrowser::loadResource(int type, const QUrl &name)
@@ -60,6 +61,7 @@ QVariant TestBrowser::loadResource(int type, const QUrl &name)
htmlLoadAttempts++;
lastResource = name;
sourceInsideLoadResource = source();
+ baseInsideLoadResource = document()->baseUrl();
return QTextBrowser::loadResource(type, name);
}
@@ -90,6 +92,10 @@ private slots:
void focusIndicator();
void focusHistory();
void urlEncoding();
+ void sourceType_data();
+ void sourceType();
+ void unicode_data();
+ void unicode();
private:
TestBrowser *browser;
@@ -108,7 +114,7 @@ void tst_QTextBrowser::init()
void tst_QTextBrowser::cleanup()
{
delete browser;
- browser = 0;
+ browser = nullptr;
}
void tst_QTextBrowser::noReloadOnAnchorJump()
@@ -428,11 +434,18 @@ void tst_QTextBrowser::sourceInsideLoadResource()
#ifdef Q_OS_WINRT
QSKIP("Paths cannot be compared if applications are sandboxed.");
#endif
- QUrl url = QUrl::fromLocalFile("pagewithimage.html");
+ QUrl url = QUrl::fromLocalFile("pagewithimage.html"); // "file://pagewithimage.html"
browser->setSource(url);
QCOMPARE(browser->lastResource, QUrl::fromLocalFile(QDir::current().filePath("foobar.png")));
+ // baseUrl was not set because the source URL was a relative one
+ QCOMPARE(browser->baseInsideLoadResource, QUrl());
QEXPECT_FAIL("", "This is currently not supported", Continue);
QCOMPARE(browser->sourceInsideLoadResource.toString(), url.toString());
+ url = QUrl::fromLocalFile(QDir::current().filePath("pagewithimage.html")); // "file:///home/user/path/to/pagewithimage.html"
+ browser->setSource(url);
+ QCOMPARE(browser->lastResource, QUrl::fromLocalFile(QDir::current().filePath("foobar.png")));
+ // baseUrl has the full path, and that's where relative-path resources come from
+ QCOMPARE(browser->baseInsideLoadResource, QUrl::fromLocalFile(QDir::currentPath() + QLatin1Char('/')));
}
void tst_QTextBrowser::textInteractionFlags_vs_readOnly()
@@ -669,5 +682,72 @@ void tst_QTextBrowser::urlEncoding()
delete browser;
}
+void tst_QTextBrowser::sourceType_data()
+{
+ QTest::addColumn<QString>("sourceFile");
+ QTest::addColumn<QTextDocument::ResourceType>("sourceType");
+ QTest::addColumn<int>("expectedMaxHeadingLevel");
+ QTest::addColumn<QTextDocument::ResourceType>("expectedSourceType");
+
+#if QT_CONFIG(textmarkdownreader)
+ const int maxMdHeadingLevel = 3;
+ const QTextDocument::ResourceType mdExpectedType = QTextDocument::MarkdownResource;
+#else
+ // If Qt doesn't support markdown, and we read a MD document anyway, it won't have any H3's.
+ const int maxMdHeadingLevel = 0;
+ const QTextDocument::ResourceType mdExpectedType = QTextDocument::HtmlResource;
+#endif
+ QTest::newRow("markdown detected") << "markdown.md" << QTextDocument::UnknownResource << maxMdHeadingLevel << mdExpectedType;
+ QTest::newRow("markdown specified") << "markdown.really" << QTextDocument::MarkdownResource << maxMdHeadingLevel << mdExpectedType;
+ QTest::newRow("markdown not identified") << "markdown.really" << QTextDocument::UnknownResource << 0 << QTextDocument::HtmlResource;
+ QTest::newRow("html detected") << "heading.html" << QTextDocument::UnknownResource << 3 << QTextDocument::HtmlResource;
+ QTest::newRow("html specified") << "heading.html" << QTextDocument::HtmlResource << 3 << QTextDocument::HtmlResource;
+}
+
+void tst_QTextBrowser::sourceType()
+{
+ QFETCH(QString, sourceFile);
+ QFETCH(QTextDocument::ResourceType, sourceType);
+ QFETCH(int, expectedMaxHeadingLevel);
+ QFETCH(QTextDocument::ResourceType, expectedSourceType);
+ if (sourceType == QTextDocument::UnknownResource)
+ // verify that the property setter works, with its default parameter for sourceType
+ browser->setProperty("source", QUrl::fromLocalFile(QFINDTESTDATA(sourceFile)));
+ else
+ browser->setSource(QUrl::fromLocalFile(QFINDTESTDATA(sourceFile)), sourceType);
+ QCOMPARE(browser->sourceType(), expectedSourceType);
+ QTextFrame::iterator iterator = browser->document()->rootFrame()->begin();
+ int maxHeadingLevel = -1;
+ while (!iterator.atEnd())
+ maxHeadingLevel = qMax(iterator++.currentBlock().blockFormat().intProperty(QTextFormat::HeadingLevel), maxHeadingLevel);
+ QCOMPARE(maxHeadingLevel, expectedMaxHeadingLevel);
+}
+
+void tst_QTextBrowser::unicode_data()
+{
+ QTest::addColumn<QString>("sourceFile");
+ QTest::addColumn<QTextDocument::ResourceType>("sourceType");
+ QTest::addColumn<QString>("expectedText");
+
+#if QT_CONFIG(textmarkdownreader)
+ QTest::newRow("markdown with quotes and fractions") << "quotesAndFractions.md" << QTextDocument::MarkdownResource <<
+ "you\u2019ll hope to see \u275Dquotes\u275E \uFE601\u00BD \u2154 \u00BC \u2157 \u215A \u215D some \u201Cvulgar\u201D fractions (pardon my \u00ABFrench\u00BB)";
+#endif
+}
+
+void tst_QTextBrowser::unicode()
+{
+ QFETCH(QString, sourceFile);
+ QFETCH(QTextDocument::ResourceType, sourceType);
+ QFETCH(QString, expectedText);
+ browser->setSource(QUrl::fromLocalFile(QFINDTESTDATA(sourceFile)), sourceType);
+ QTextFrame::iterator iterator = browser->document()->rootFrame()->begin();
+ while (!iterator.atEnd()) {
+ QString blockText = iterator++.currentBlock().text();
+ if (!blockText.isEmpty())
+ QCOMPARE(blockText, expectedText);
+ }
+}
+
QTEST_MAIN(tst_QTextBrowser)
#include "tst_qtextbrowser.moc"
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 3669935823..c2cf31bfa4 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -160,6 +160,7 @@ private slots:
void selectionChanged();
#ifndef QT_NO_CLIPBOARD
void copyPasteBackgroundImage();
+ void copyPasteForegroundImage();
#endif
void setText();
void cursorRect();
@@ -1904,6 +1905,36 @@ void tst_QTextEdit::copyPasteBackgroundImage()
ba.texture().cacheKey() == bb.texture().cacheKey());
QFile::remove(QLatin1String("foo.png"));
}
+
+void tst_QTextEdit::copyPasteForegroundImage()
+{
+ ed->clear();
+
+ QPixmap pix(20, 20);
+ pix.fill(Qt::blue);
+
+ QTextCharFormat fmt;
+ {
+ QBrush textureBrush;
+ {
+ textureBrush.setTexture(pix);
+ }
+ textureBrush.setStyle(Qt::TexturePattern);
+ fmt.setForeground(textureBrush);
+ }
+ ed->textCursor().insertText("Foobar", fmt);
+
+ ed->moveCursor(QTextCursor::Start);
+ ed->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor);
+
+ ed->copy();
+ ed->clear();
+ ed->paste();
+
+ QBrush brush = ed->textCursor().charFormat().foreground();
+ QCOMPARE(brush.style(), Qt::TexturePattern);
+ QCOMPARE(brush.texture().cacheKey(), pix.cacheKey());
+}
#endif
void tst_QTextEdit::setText()
@@ -2638,12 +2669,14 @@ void tst_QTextEdit::wheelEvent()
ed.setReadOnly(true);
float defaultFontSize = ed.font().pointSizeF();
- QWheelEvent wheelUp(QPointF(), QPointF(), QPoint(), QPoint(0, 120), 120, Qt::Vertical, Qt::NoButton, Qt::ControlModifier);
+ QWheelEvent wheelUp(QPointF(), QPointF(), QPoint(), QPoint(0, 120),
+ Qt::NoButton, Qt::ControlModifier, Qt::NoScrollPhase, Qt::MouseEventNotSynthesized);
ed.wheelEvent(&wheelUp);
QCOMPARE(defaultFontSize + 1, ed.font().pointSizeF());
- QWheelEvent wheelHalfDown(QPointF(), QPointF(), QPoint(), QPoint(0, -60), -60, Qt::Vertical, Qt::NoButton, Qt::ControlModifier);
+ QWheelEvent wheelHalfDown(QPointF(), QPointF(), QPoint(), QPoint(0, -60),
+ Qt::NoButton, Qt::ControlModifier, Qt::NoScrollPhase, Qt::MouseEventNotSynthesized);
ed.wheelEvent(&wheelHalfDown);
QCOMPARE(defaultFontSize + 0.5, ed.font().pointSizeF());
diff --git a/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST b/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST
index df4fda196f..52ba36562f 100644
--- a/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST
+++ b/tests/auto/widgets/widgets/qtoolbutton/BLACKLIST
@@ -1,2 +1,2 @@
[task176137_autoRepeatOfAction]
-osx ci
+osx-10.13