summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/dialogs.pro5
-rw-r--r--tests/auto/widgets/dialogs/qabstractprintdialog/.gitignore1
-rw-r--r--tests/auto/widgets/dialogs/qabstractprintdialog/qabstractprintdialog.pro9
-rw-r--r--tests/auto/widgets/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp144
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp4
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp17
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp10
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp4
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp47
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp96
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp36
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp8
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro2
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qlistview/qlistview.pro2
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp28
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp22
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp30
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp114
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp2
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp318
-rw-r--r--tests/auto/widgets/kernel/qwidget/qwidget.pro2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp66
-rw-r--r--tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp2
-rw-r--r--tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp2
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp30
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp2
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp18
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp48
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp4
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp217
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp6
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp56
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp6
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp49
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro2
-rw-r--r--tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp2
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp15
-rw-r--r--tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp6
47 files changed, 871 insertions, 583 deletions
diff --git a/tests/auto/widgets/dialogs/dialogs.pro b/tests/auto/widgets/dialogs/dialogs.pro
index acff1df5ba..c6667824d9 100644
--- a/tests/auto/widgets/dialogs/dialogs.pro
+++ b/tests/auto/widgets/dialogs/dialogs.pro
@@ -1,6 +1,5 @@
TEMPLATE=subdirs
SUBDIRS=\
- qabstractprintdialog \
qcolordialog \
qdialog \
qerrormessage \
@@ -14,10 +13,8 @@ SUBDIRS=\
qsidebar \
qwizard \
-wince*|!qtHaveModule(printsupport):SUBDIRS -= qabstractprintdialog
-
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qsidebar \
mac:qinputdialog.CONFIG += no_check_target # QTBUG-25496
-win32-g++*: SUBDIRS -= qfilesystemmodel # QTBUG-29403
+mingw: SUBDIRS -= qfilesystemmodel # QTBUG-29403
diff --git a/tests/auto/widgets/dialogs/qabstractprintdialog/.gitignore b/tests/auto/widgets/dialogs/qabstractprintdialog/.gitignore
deleted file mode 100644
index a768494da5..0000000000
--- a/tests/auto/widgets/dialogs/qabstractprintdialog/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_qabstractprintdialog
diff --git a/tests/auto/widgets/dialogs/qabstractprintdialog/qabstractprintdialog.pro b/tests/auto/widgets/dialogs/qabstractprintdialog/qabstractprintdialog.pro
deleted file mode 100644
index 2e9ae33592..0000000000
--- a/tests/auto/widgets/dialogs/qabstractprintdialog/qabstractprintdialog.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-############################################################
-# Project file for autotest for file qabstractprintdialog.h
-############################################################
-
-CONFIG += testcase
-CONFIG += parallel_test
-TARGET = tst_qabstractprintdialog
-QT += widgets printsupport testlib
-SOURCES += tst_qabstractprintdialog.cpp
diff --git a/tests/auto/widgets/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp b/tests/auto/widgets/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp
deleted file mode 100644
index c79a4a97ef..0000000000
--- a/tests/auto/widgets/dialogs/qabstractprintdialog/tst_qabstractprintdialog.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-
-#include <qcoreapplication.h>
-#include <qdebug.h>
-#include <qabstractprintdialog.h>
-#include <qprinter.h>
-
-class tst_QAbstractPrintDialog : public QObject
-{
-Q_OBJECT
-
-#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG)
-public slots:
- void initTestCase();
-#else
-private slots:
- void getSetCheck();
- void setMinMax();
- void setFromTo();
-#endif
-};
-
-#if defined(QT_NO_PRINTER) || defined(QT_NO_PRINTDIALOG)
-void tst_QAbstractPrintDialog::initTestCase()
-{
- QSKIP("This test requires printing and print dialog support");
-}
-
-#else
-
-class MyAbstractPrintDialog : public QAbstractPrintDialog
-{
-public:
- MyAbstractPrintDialog(QPrinter *p) : QAbstractPrintDialog(p) {}
- int exec() { return 0; }
-};
-
-// Testing get/set functions
-void tst_QAbstractPrintDialog::getSetCheck()
-{
- QPrinter printer;
- MyAbstractPrintDialog obj1(&printer);
- QCOMPARE(obj1.printer(), &printer);
- // PrintDialogOptions QAbstractPrintDialog::enabledOptions()
- // void QAbstractPrintDialog::setEnabledOptions(PrintDialogOptions)
- obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::None));
- QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::None), obj1.enabledOptions());
- obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintToFile));
- QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintToFile), obj1.enabledOptions());
- obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintSelection));
- QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintSelection), obj1.enabledOptions());
- obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintPageRange));
- QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintPageRange), obj1.enabledOptions());
- obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintCollateCopies));
- QCOMPARE(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::PrintCollateCopies), obj1.enabledOptions());
-
- // PrintRange QAbstractPrintDialog::printRange()
- // void QAbstractPrintDialog::setPrintRange(PrintRange)
- obj1.setPrintRange(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::AllPages));
- QCOMPARE(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::AllPages), obj1.printRange());
- obj1.setPrintRange(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::Selection));
- QCOMPARE(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::Selection), obj1.printRange());
- obj1.setPrintRange(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::PageRange));
- QCOMPARE(QAbstractPrintDialog::PrintRange(QAbstractPrintDialog::PageRange), obj1.printRange());
-}
-
-void tst_QAbstractPrintDialog::setMinMax()
-{
- QPrinter printer;
- MyAbstractPrintDialog obj1(&printer);
- obj1.setEnabledOptions(QAbstractPrintDialog::PrintDialogOptions(QAbstractPrintDialog::None));
- QEXPECT_FAIL("", "QTBUG-22637", Abort);
- QCOMPARE(obj1.minPage(), 1);
- QCOMPARE(obj1.maxPage(), INT_MAX);
- QVERIFY(!obj1.isOptionEnabled(QAbstractPrintDialog::PrintPageRange));
- obj1.setMinMax(2,5);
- QCOMPARE(obj1.minPage(), 2);
- QCOMPARE(obj1.maxPage(), 5);
- QVERIFY(obj1.enabledOptions() & QAbstractPrintDialog::PrintPageRange);
- QVERIFY(obj1.isOptionEnabled(QAbstractPrintDialog::PrintPageRange));
-}
-
-void tst_QAbstractPrintDialog::setFromTo()
-{
- QPrinter printer;
- MyAbstractPrintDialog obj1(&printer);
- QCOMPARE(obj1.fromPage(), 0);
- QCOMPARE(obj1.toPage(), 0);
- obj1.setMinMax(0,0);
- QCOMPARE(obj1.minPage(), 0);
- QCOMPARE(obj1.maxPage(), 0);
- obj1.setFromTo(20,50);
- QCOMPARE(obj1.fromPage(), 20);
- QCOMPARE(obj1.toPage(), 50);
- QCOMPARE(obj1.minPage(), 1);
- QCOMPARE(obj1.maxPage(), 50);
-}
-
-#endif
-
-QTEST_MAIN(tst_QAbstractPrintDialog)
-#include "tst_qabstractprintdialog.moc"
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index 1aab794e1b..d8833e232d 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -200,7 +200,7 @@ void tst_QDialog::showExtension()
// show
((DummyDialog*)testWidget)->showExtension( true );
// while ( testWidget->size() == dlgSize )
-// qApp->processEvents();
+// qApp->processEvents();
QTEST( testWidget->size(), "result" );
diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
index b9e6c82d84..217fb4c30b 100644
--- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
@@ -310,10 +310,10 @@ void tst_QFileDialog2::unc()
void tst_QFileDialog2::emptyUncPath()
{
QNonNativeFileDialog fd;
- fd.show();
+ fd.show();
QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit");
QVERIFY(lineEdit);
- // press 'keys' for the input
+ // press 'keys' for the input
for (int i = 0; i < 3 ; ++i)
QTest::keyPress(lineEdit, Qt::Key_Backslash);
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 9cb391d5f4..b29bf44307 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -164,12 +164,12 @@ void tst_QFileSystemModel::cleanup()
for (int i = 0; i < list.count(); ++i) {
QFileInfo fi(dir.path() + '/' + list.at(i));
if (fi.exists() && fi.isFile()) {
- QFile p(fi.absoluteFilePath());
+ 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();
- }
- if (fi.exists() && fi.isDir())
+ QFile dead(dir.path() + '/' + list.at(i));
+ dead.remove();
+ }
+ if (fi.exists() && fi.isDir())
QVERIFY(dir.rmdir(list.at(i)));
}
list = dir.entryList(QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot);
@@ -424,7 +424,14 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
wchar_t nativeHiddenFile[MAX_PATH];
memset(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
hiddenFile.toWCharArray(nativeHiddenFile);
+#ifndef Q_OS_WINRT
DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile);
+#else // !Q_OS_WINRT
+ WIN32_FILE_ATTRIBUTE_DATA attributeData;
+ if (!::GetFileAttributesEx(nativeHiddenFile, GetFileExInfoStandard, &attributeData))
+ attributeData.dwFileAttributes = 0xFFFFFFFF;
+ DWORD currentAttributes = attributeData.dwFileAttributes;
+#endif // Q_OS_WINRT
if (currentAttributes == 0xFFFFFFFF) {
qErrnoWarning("failed to get file attributes: %s", qPrintable(hiddenFile));
return false;
diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
index 1762e40a9d..6eb36115cb 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
@@ -108,11 +108,11 @@ void tst_QFontDialog::cleanup()
void tst_QFontDialog::postKeyReturn() {
QWidgetList list = QApplication::topLevelWidgets();
for (int i=0; i<list.count(); ++i) {
- QFontDialog *dialog = qobject_cast<QFontDialog*>(list[i]);
- if (dialog) {
- QTest::keyClick( list[i], Qt::Key_Return, Qt::NoModifier );
- return;
- }
+ QFontDialog *dialog = qobject_cast<QFontDialog*>(list[i]);
+ if (dialog) {
+ QTest::keyClick( list[i], Qt::Key_Return, Qt::NoModifier );
+ return;
+ }
}
}
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
index 7d8077d77d..abd120db86 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
@@ -110,7 +110,7 @@ void testTypingValue(
sbox->selectAll();
for (int i = 0; i < value.size(); ++i) {
const QChar valChar = value[i];
- _keyClick(static_cast<QWidget *>(sbox), valChar.toLatin1()); // ### always guaranteed to work?
+ _keyClick(static_cast<QWidget *>(sbox), valChar.toLatin1()); // ### always guaranteed to work?
if (sbox->hasAcceptableInput())
QVERIFY(okButton->isEnabled());
else
@@ -123,7 +123,7 @@ void testTypingValue(QLineEdit *ledit, QPushButton *okButton, const QString &val
ledit->selectAll();
for (int i = 0; i < value.size(); ++i) {
const QChar valChar = value[i];
- _keyClick(ledit, valChar.toLatin1()); // ### always guaranteed to work?
+ _keyClick(ledit, valChar.toLatin1()); // ### always guaranteed to work?
QVERIFY(ledit->hasAcceptableInput());
QVERIFY(okButton->isEnabled());
}
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index a711bc28e3..4c07b48c00 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -90,6 +90,7 @@ private slots:
void setOption_HaveNextButtonOnLastPage();
void setOption_HaveFinishButtonOnEarlyPages();
void setOption_NoCancelButton();
+ void setOption_NoCancelButtonOnLastPage();
void setOption_CancelButtonOnLeft();
void setOption_HaveHelpButton();
void setOption_HelpButtonOnRight();
@@ -1423,6 +1424,50 @@ void tst_QWizard::setOption_NoCancelButton()
}
}
+void tst_QWizard::setOption_NoCancelButtonOnLastPage()
+{
+ for (int i = 0; i < 2; ++i) {
+ QWizard wizard;
+ wizard.setOption(QWizard::NoCancelButton, false);
+ wizard.setOption(QWizard::NoCancelButtonOnLastPage, true);
+ wizard.addPage(new QWizardPage);
+ wizard.addPage(new QWizardPage);
+ wizard.page(1)->setFinalPage(true); // changes nothing (final != last in general)
+ wizard.addPage(new QWizardPage);
+
+ wizard.setStartId(1);
+ wizard.show();
+ qApp->processEvents();
+
+ QVERIFY(wizard.button(QWizard::CancelButton)->isVisible());
+
+ wizard.next();
+ qApp->processEvents();
+ QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible());
+
+ wizard.next();
+ qApp->processEvents();
+ QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible());
+
+ wizard.back();
+ qApp->processEvents();
+ QVERIFY(wizard.button(QWizard::CancelButton)->isVisible());
+
+ wizard.next();
+ qApp->processEvents();
+ QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible());
+
+ wizard.setOption(QWizard::NoCancelButtonOnLastPage, false);
+ QVERIFY(wizard.button(QWizard::CancelButton)->isVisible());
+
+ wizard.setOption(QWizard::NoCancelButtonOnLastPage, true);
+ QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible());
+
+ wizard.addPage(new QWizardPage);
+ QVERIFY(!wizard.button(QWizard::CancelButton)->isVisible()); // this is maybe wrong
+ }
+}
+
void tst_QWizard::setOption_CancelButtonOnLeft()
{
for (int i = 0; i < 2; ++i) {
@@ -1767,7 +1812,7 @@ public:
QWizardPage *page_to_delete = page(id);
removePage(id);
delete page_to_delete;
- }
+ }
}
void applyOperations(const QList<Operation *> &operations)
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 1ffb5c3b5c..78ab8027d8 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -2974,7 +2974,7 @@ void tst_QGraphicsGridLayout::geometries()
void tst_QGraphicsGridLayout::avoidRecursionInInsertItem()
{
QGraphicsWidget window(0, Qt::Window);
- QGraphicsGridLayout *layout = new QGraphicsGridLayout(&window);
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout(&window);
QCOMPARE(layout->count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QGraphicsGridLayout::addItem: cannot insert itself");
layout->addItem(layout, 0, 0);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
index 0c3b46c5d5..527f62b22d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro
@@ -5,5 +5,5 @@ QT += core-private gui-private
SOURCES += tst_qgraphicsitem.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-win32:!wince*: LIBS += -luser32
+win32:!wince*:!winrt: LIBS += -luser32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index fc1d0e34cb..de7c528825 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -71,7 +71,7 @@ Q_DECLARE_METATYPE(QPainterPath)
#include "../../../qtest-config.h"
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 6366f86250..6a3e69d0a8 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -1,3 +1,4 @@
+
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
@@ -47,6 +48,8 @@
#include <qgraphicsscene.h>
#include <qgraphicsview.h>
#include <qapplication.h>
+#include <QtWidgets/qstyle.h>
+#include <QtWidgets/qproxystyle.h>
class tst_QGraphicsLinearLayout : public QObject {
Q_OBJECT
@@ -86,6 +89,7 @@ private slots:
void removeItem();
void setGeometry_data();
void setGeometry();
+ void defaultSpacing();
void setSpacing_data();
void setSpacing();
void setItemSpacing_data();
@@ -770,7 +774,7 @@ void tst_QGraphicsLinearLayout::orientation()
layout.setOrientation(orientation);
QCOMPARE(layout.orientation(), orientation);
- // important to resize to preferredsize when orientation is switched
+ // important to resize to preferredsize when orientation is switched
widget->resize(widget->effectiveSizeHint(Qt::PreferredSize));
qApp->processEvents();
for (i = 0; i < positions.count(); ++i) {
@@ -909,6 +913,94 @@ void tst_QGraphicsLinearLayout::setGeometry()
delete widget;
}
+class LayoutStyle : public QProxyStyle
+{
+public:
+ LayoutStyle(const QString &key)
+ : QProxyStyle(key),
+ horizontalSpacing(-1), verticalSpacing(-1) {}
+
+ virtual int pixelMetric(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ {
+ if (pm == QStyle::PM_LayoutHorizontalSpacing && horizontalSpacing >= 0) {
+ return horizontalSpacing;
+ } else if (pm == QStyle::PM_LayoutVerticalSpacing && verticalSpacing >= 0) {
+ return verticalSpacing;
+ }
+ return QProxyStyle::pixelMetric(pm, option, widget);
+ }
+
+ int horizontalSpacing;
+ int verticalSpacing;
+};
+
+void tst_QGraphicsLinearLayout::defaultSpacing()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ LayoutStyle *style = new LayoutStyle(QLatin1String("windows"));
+ style->horizontalSpacing = 5;
+ style->verticalSpacing = 3;
+ LayoutStyle *style2 = new LayoutStyle(QLatin1String("windows"));
+ style2->horizontalSpacing = 25;
+ style2->verticalSpacing = 23;
+
+ QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
+ widget->setStyle(style);
+
+ // Horizontal layout
+ SubQGraphicsLinearLayout *layout = new SubQGraphicsLinearLayout(Qt::Horizontal);
+ widget->setLayout(layout);
+ Q_ASSERT(widget->style());
+ scene.addItem(widget);
+ layout->setContentsMargins(0, 0, 0, 0);
+ view.show();
+
+ for (int i = 0; i < 2; ++i) {
+ QGraphicsWidget *w = new QGraphicsWidget;
+ layout->addItem(w);
+ }
+
+ // Horizontal layout
+ qreal styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
+ QCOMPARE(styleSpacing, qreal(5));
+ QCOMPARE(styleSpacing, layout->spacing());
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).width(), qreal(105));
+ style->horizontalSpacing = 15;
+ // If the style method changes return value, the layout must be invalidated by the application
+ layout->invalidate();
+ styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
+ QCOMPARE(styleSpacing, qreal(15));
+ QCOMPARE(styleSpacing, layout->spacing());
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).width(), qreal(115));
+ widget->setStyle(style2);
+ // If the style itself changes, the layout will pick that up
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).width(), qreal(125));
+ QCOMPARE(layout->spacing(), qreal(25));
+
+ // Vertical layout
+ widget->setStyle(style);
+ layout->setOrientation(Qt::Vertical);
+ styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
+ QCOMPARE(styleSpacing, qreal(3));
+ QCOMPARE(styleSpacing, layout->spacing());
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).height(), qreal(103));
+ style->verticalSpacing = 13;
+ // If the style method changes return value, the layout must be invalidated by the application
+ layout->invalidate();
+ styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
+ QCOMPARE(styleSpacing, qreal(13));
+ QCOMPARE(styleSpacing, layout->spacing());
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).height(), qreal(113));
+ widget->setStyle(style2);
+ // If the style itself changes, the layout will pick that up
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).height(), qreal(123));
+ QCOMPARE(layout->spacing(), qreal(23));
+
+
+ delete widget;
+}
+
void tst_QGraphicsLinearLayout::setSpacing_data()
{
QTest::addColumn<qreal>("spacing");
@@ -1469,7 +1561,7 @@ void tst_QGraphicsLinearLayout::removeLayout()
void tst_QGraphicsLinearLayout::avoidRecursionInInsertItem()
{
QGraphicsWidget window(0, Qt::Window);
- QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(&window);
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(&window);
QCOMPARE(layout->count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QGraphicsLinearLayout::insertItem: cannot insert itself");
layout->insertItem(0, layout);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 92de2c6733..d3f6c2db00 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -1230,17 +1230,17 @@ void tst_QGraphicsProxyWidget::mousePressReleaseEvent()
view.resize(100, 100);
if (hasWidget) {
proxy->setWidget(widget);
- proxy->show();
+ proxy->show();
}
proxy->setPos(50, 0);
scene.addItem(proxy);
proxy->setFocus();
QTest::mousePress(view.viewport(), Qt::LeftButton, 0,
- view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
+ view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
QTRY_COMPARE(spy.count(), 0);
QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0,
- view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
+ view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
QTRY_COMPARE(spy.count(), (hasWidget) ? 1 : 0);
if (!hasWidget)
@@ -1439,16 +1439,16 @@ class View : public QGraphicsView
{
public:
View(QGraphicsScene *scene, QWidget *parent = 0)
- : QGraphicsView(scene, parent), npaints(0)
+ : QGraphicsView(scene, parent), npaints(0)
{ }
QRegion paintEventRegion;
int npaints;
protected:
void paintEvent(QPaintEvent *event)
{
- ++npaints;
- paintEventRegion += event->region();
- QGraphicsView::paintEvent(event);
+ ++npaints;
+ paintEventRegion += event->region();
+ QGraphicsView::paintEvent(event);
}
};
@@ -1458,7 +1458,7 @@ class ScrollWidget : public QWidget
public:
ScrollWidget() : npaints(0)
{
- resize(200, 200);
+ resize(200, 200);
}
QRegion paintEventRegion;
int npaints;
@@ -1466,17 +1466,17 @@ public:
public slots:
void updateScroll()
{
- update(0, 0, 200, 10);
- scroll(0, 10, QRect(0, 0, 100, 20));
+ update(0, 0, 200, 10);
+ scroll(0, 10, QRect(0, 0, 100, 20));
}
protected:
void paintEvent(QPaintEvent *event)
{
- ++npaints;
- paintEventRegion += event->region();
- QPainter painter(this);
- painter.fillRect(event->rect(), Qt::blue);
+ ++npaints;
+ paintEventRegion += event->region();
+ QPainter painter(this);
+ painter.fillRect(event->rect(), Qt::blue);
}
};
@@ -1502,7 +1502,7 @@ void tst_QGraphicsProxyWidget::scrollUpdate()
// QRect(0, 12, 102, 10) is the scroll update, expanded (-2, -2, 2, 2),
// intersected with the above update.
QCOMPARE(view.paintEventRegion.rects(),
- QVector<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
+ QVector<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
QCOMPARE(widget->npaints, 2);
QCOMPARE(widget->paintEventRegion.rects(),
QVector<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
@@ -2458,7 +2458,7 @@ void tst_QGraphicsProxyWidget::popup_basic()
QComboBox *box = new QComboBox;
box->setGeometry(0, 0, 320, 40);
box->addItems(QStringList() << "monday" << "tuesday" << "wednesday"
- << "thursday" << "saturday" << "sunday");
+ << "thursday" << "saturday" << "sunday");
QCOMPARE(proxy->childItems().count(), 0);
proxy->setWidget(box);
proxy->show();
@@ -2472,7 +2472,7 @@ void tst_QGraphicsProxyWidget::popup_basic()
QApplication::processEvents();
QTest::mousePress(view.viewport(), Qt::LeftButton, 0,
- view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
+ view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
QTRY_COMPARE(box->pos(), QPoint());
@@ -2511,7 +2511,7 @@ void tst_QGraphicsProxyWidget::popup_subwidget()
QComboBox *box = new QComboBox;
box->addItems(QStringList() << "monday" << "tuesday" << "wednesday"
- << "thursday" << "saturday" << "sunday");
+ << "thursday" << "saturday" << "sunday");
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(new QLineEdit("QLineEdit"));
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro
index 8d00931ef1..a6022e0d7d 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:!wince*: LIBS += -luser32
+win32:!wince*:!winrt: LIBS += -luser32
!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\"
DEFINES += QT_NO_CAST_TO_ASCII
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 15c92663ec..dfc8465210 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -54,7 +54,7 @@
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 97ea7d7d32..e4167aacad 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -216,10 +216,10 @@ private slots:
void persistentEditorFocus();
void setItemDelegate();
void setItemDelegate_data();
- // The dragAndDrop() test doesn't work, and is thus disabled on Mac and Windows
- // for the following reasons:
- // Mac: use of GetCurrentEventButtonState() in QDragManager::drag()
- // Win: unknown reason
+ // The dragAndDrop() test doesn't work, and is thus disabled on Mac and Windows
+ // for the following reasons:
+ // Mac: use of GetCurrentEventButtonState() in QDragManager::drag()
+ // Win: unknown reason
#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN)
#if 0
void dragAndDrop();
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro b/tests/auto/widgets/itemviews/qitemdelegate/qitemdelegate.pro
index cb935fd2fd..313cadd6a1 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 testlib
SOURCES += tst_qitemdelegate.cpp
-win32:!wince*: LIBS += -luser32
+win32:!wince*:!winrt: LIBS += -luser32
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 439725b257..addb226101 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -66,7 +66,7 @@
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#include <windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro
index 413304bdcf..1ea8beb8df 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
SOURCES += tst_qlistview.cpp
-win32:!wince*: LIBS += -luser32
+win32:!wince*:!winrt: LIBS += -luser32
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 268276bd4a..9f5484983d 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -1484,7 +1484,7 @@ void tst_QListView::wordWrap()
QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), true);
}
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog
{
Q_OBJECT
@@ -1525,7 +1525,7 @@ private:
};
#endif
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && WINVER >= 0x0500
// This test only makes sense on windows 2000 and higher.
void tst_QListView::setCurrentIndexAfterAppendRowCrash()
{
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index 42975cfb5e..153144db63 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
@@ -1646,29 +1646,29 @@ void tst_QListWidget::QTBUG8086_currentItemChangedOnClick()
class ItemDelegate : public QItemDelegate
{
public:
- ItemDelegate(QObject *parent = 0) : QItemDelegate(parent)
- {}
- virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const
- {
- QLineEdit *lineEdit = new QLineEdit(parent);
- lineEdit->setFrame(false);
- QCompleter *completer = new QCompleter(QStringList() << "completer", lineEdit);
- completer->setCompletionMode(QCompleter::InlineCompletion);
- lineEdit->setCompleter(completer);
- return lineEdit;
- }
+ ItemDelegate(QObject *parent = 0) : QItemDelegate(parent)
+ {}
+ virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const
+ {
+ QLineEdit *lineEdit = new QLineEdit(parent);
+ lineEdit->setFrame(false);
+ QCompleter *completer = new QCompleter(QStringList() << "completer", lineEdit);
+ completer->setCompletionMode(QCompleter::InlineCompletion);
+ lineEdit->setCompleter(completer);
+ return lineEdit;
+ }
};
void tst_QListWidget::QTBUG14363_completerWithAnyKeyPressedEditTriggers()
{
- QListWidget listWidget;
- listWidget.setEditTriggers(QAbstractItemView::AnyKeyPressed);
+ QListWidget listWidget;
+ listWidget.setEditTriggers(QAbstractItemView::AnyKeyPressed);
listWidget.setItemDelegate(new ItemDelegate);
QListWidgetItem *item = new QListWidgetItem(QLatin1String("select an item (don't start editing)"), &listWidget);
item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable|Qt::ItemIsEditable);
new QListWidgetItem(QLatin1String("try to type the letter 'c'"), &listWidget);
new QListWidgetItem(QLatin1String("completer"), &listWidget);
- listWidget.show();
+ listWidget.show();
listWidget.setCurrentItem(item);
qApp->setActiveWindow(&listWidget);
QVERIFY(QTest::qWaitForWindowActive(&listWidget));
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 76ac6bcf19..f7613a59f3 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -1643,7 +1643,7 @@ void tst_QTableView::selection()
view.setColumnWidth(c, columnWidth);
view.setSelection(QRect(x, y, width, height),
- QItemSelectionModel::SelectionFlags(command));
+ QItemSelectionModel::SelectionFlags(command));
QCOMPARE(view.selectedIndexes().count(), selectedCount);
}
@@ -2950,7 +2950,7 @@ void tst_QTableView::span()
if (hiddenRow > -1) {
QModelIndex hidden = model.index(hiddenRow, columnCount - 1);
- QVERIFY(view.isIndexHidden(hidden));
+ QVERIFY(view.isIndexHidden(hidden));
}
if (hiddenColumn > -1) {
@@ -3597,7 +3597,7 @@ void tst_QTableView::task173773_updateVerticalHeader()
void tst_QTableView::task227953_setRootIndex()
{
- QTableView tableView;
+ QTableView tableView;
//model = tree with two items with tables as children
QStandardItemModel model;
@@ -3619,16 +3619,16 @@ void tst_QTableView::task227953_setRootIndex()
//show the first 10 rows of the first table
QModelIndex root = model.indexFromItem(&item1);
- tableView.setRootIndex(root);
- for (int i = 10; i != 40; ++i) {
- tableView.setRowHidden(i, true);
- }
+ tableView.setRootIndex(root);
+ for (int i = 10; i != 40; ++i) {
+ tableView.setRowHidden(i, true);
+ }
QCOMPARE(tableView.verticalHeader()->count(), 40);
QCOMPARE(tableView.verticalHeader()->hiddenSectionCount(), 30);
- //show the first 10 rows of the second table
- tableView.setRootIndex(model.indexFromItem(&item2));
+ //show the first 10 rows of the second table
+ tableView.setRootIndex(model.indexFromItem(&item2));
QCOMPARE(tableView.verticalHeader()->count(), 10);
QCOMPARE(tableView.verticalHeader()->hiddenSectionCount(), 0);
@@ -3670,8 +3670,8 @@ void tst_QTableView::task248688_autoScrollNavigation()
QTableView view;
view.setModel(&model);
- view.hideColumn(8);
- view.hideRow(8);
+ view.hideColumn(8);
+ view.hideRow(8);
view.show();
for (int r = 0; r < model.rowCount(); ++r) {
if (view.isRowHidden(r))
diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
index 83ba1ddcda..dfa7592813 100644
--- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
@@ -1467,14 +1467,14 @@ void tst_QTreeWidget::keyboardNavigation()
QVector<Qt::Key> keymoves;
keymoves << Qt::Key_Down << Qt::Key_Right << Qt::Key_Left
- << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down
- << Qt::Key_Right
- << Qt::Key_Up << Qt::Key_Left << Qt::Key_Left
- << Qt::Key_Up << Qt::Key_Down << Qt::Key_Up << Qt::Key_Up
- << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up
+ << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down << Qt::Key_Down
+ << Qt::Key_Right
+ << Qt::Key_Up << Qt::Key_Left << Qt::Key_Left
+ << Qt::Key_Up << Qt::Key_Down << Qt::Key_Up << Qt::Key_Up
+ << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up << Qt::Key_Up
<< Qt::Key_Down << Qt::Key_Right << Qt::Key_Down << Qt::Key_Down
<< Qt::Key_Down << Qt::Key_Right << Qt::Key_Down << Qt::Key_Down
- << Qt::Key_Left << Qt::Key_Left << Qt::Key_Up << Qt::Key_Down
+ << Qt::Key_Left << Qt::Key_Left << Qt::Key_Up << Qt::Key_Down
<< Qt::Key_Up << Qt::Key_Up << Qt::Key_Up << Qt::Key_Left
<< Qt::Key_Down << Qt::Key_Right << Qt::Key_Right << Qt::Key_Right
<< Qt::Key_Left << Qt::Key_Left << Qt::Key_Right << Qt::Key_Left;
@@ -1499,16 +1499,16 @@ void tst_QTreeWidget::keyboardNavigation()
switch (key) {
case Qt::Key_Up:
- if (row > 0) {
+ if (row > 0) {
if (item->parent())
item = item->parent()->child(row - 1);
else
item = testWidget->topLevelItem(row - 1);
- row -= 1;
- } else if (item->parent()) {
- item = item->parent();
- row = item->parent() ? item->parent()->indexOfChild(item) : testWidget->indexOfTopLevelItem(item);
- }
+ row -= 1;
+ } else if (item->parent()) {
+ item = item->parent();
+ row = item->parent() ? item->parent()->indexOfChild(item) : testWidget->indexOfTopLevelItem(item);
+ }
break;
case Qt::Key_Down:
if (testWidget->isItemExpanded(item)) {
@@ -1537,7 +1537,7 @@ void tst_QTreeWidget::keyboardNavigation()
case Qt::Key_Right:
if (checkScroll)
QCOMPARE(scrollBar->value(), valueBeforeClick + scrollBar->singleStep());
- // windows style right will walk to the first child
+ // windows style right will walk to the first child
if (testWidget->currentItem() != item) {
QCOMPARE(testWidget->currentItem()->parent(), item);
row = item->indexOfChild(testWidget->currentItem());
@@ -1758,9 +1758,7 @@ void tst_QTreeWidget::setData()
QCOMPARE(qvariant_cast<QTreeWidgetItem*>(args.at(0)), item);
QCOMPARE(qvariant_cast<int>(args.at(1)), j);
item->setIcon(j, icon);
- // #### shouldn't cause dataChanged()
- QCOMPARE(itemChangedSpy.count(), 1);
- itemChangedSpy.clear();
+ QCOMPARE(itemChangedSpy.count(), 0);
QString toolTip = QString("toolTip %0").arg(i);
item->setToolTip(j, toolTip);
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 091927abe4..9d7d3d1f34 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -179,6 +179,8 @@ private slots:
void globalStaticObjectDestruction(); // run this last
void abortQuitOnShow();
+
+ void settableStyleHints(); // Needs to run last as it changes style hints.
};
class EventSpy : public QObject
@@ -286,7 +288,7 @@ public:
TestApplication( int &argc, char **argv )
: QApplication( argc, argv)
{
- startTimer( 150 );
+ startTimer( 150 );
}
void timerEvent( QTimerEvent * )
@@ -336,24 +338,24 @@ void tst_QApplication::multiple()
int i = 0;
int argc = 0;
- while ( i++ < 5 ) {
- TestApplication app( argc, 0 );
-
- if ( features.contains( "QFont" ) ) {
- // create font and force loading
- QFont font( "Arial", 12 );
- QFontInfo finfo( font );
- finfo.exactMatch();
- }
- if ( features.contains( "QPixmap" ) ) {
- QPixmap pix( 100, 100 );
- pix.fill( Qt::black );
- }
- if ( features.contains( "QWidget" ) ) {
- QWidget widget;
- }
-
- QVERIFY(!app.exec());
+ while (i++ < 5) {
+ TestApplication app(argc, 0);
+
+ if (features.contains("QFont")) {
+ // create font and force loading
+ QFont font("Arial", 12);
+ QFontInfo finfo(font);
+ finfo.exactMatch();
+ }
+ if (features.contains("QPixmap")) {
+ QPixmap pix(100, 100);
+ pix.fill(Qt::black);
+ }
+ if (features.contains("QWidget")) {
+ QWidget widget;
+ }
+
+ QVERIFY(!app.exec());
}
}
@@ -382,29 +384,29 @@ void tst_QApplication::setFont_data()
QFontDatabase fdb;
QStringList families = fdb.families();
for (QStringList::const_iterator itr = families.begin();
- itr != families.end();
- ++itr) {
- if (cnt < 3) {
- QString family = *itr;
- QStringList styles = fdb.styles(family);
- if (styles.size() > 0) {
- QString style = styles.first();
- QList<int> sizes = fdb.pointSizes(family, style);
- if (!sizes.size())
- sizes = fdb.standardSizes();
- if (sizes.size() > 0) {
- QTest::newRow(QString("data%1a").arg(cnt).toLatin1().constData())
- << family
- << sizes.first()
+ itr != families.end();
+ ++itr) {
+ if (cnt < 3) {
+ QString family = *itr;
+ QStringList styles = fdb.styles(family);
+ if (styles.size() > 0) {
+ QString style = styles.first();
+ QList<int> sizes = fdb.pointSizes(family, style);
+ if (!sizes.size())
+ sizes = fdb.standardSizes();
+ if (sizes.size() > 0) {
+ QTest::newRow(QString("data%1a").arg(cnt).toLatin1().constData())
+ << family
+ << sizes.first()
<< false;
- QTest::newRow(QString("data%1b").arg(cnt).toLatin1().constData())
- << family
- << sizes.first()
+ QTest::newRow(QString("data%1b").arg(cnt).toLatin1().constData())
+ << family
+ << sizes.first()
<< true;
}
- }
- }
- ++cnt;
+ }
+ }
+ ++cnt;
}
QTest::newRow("nonexistingfont after") << "nosuchfont_probably_quiteunlikely"
@@ -450,7 +452,7 @@ void tst_QApplication::args_data()
QTest::newRow( "No arguments" ) << 0 << QString() << 0 << QString();
QTest::newRow( "App name, style" ) << 3 << "/usr/bin/appname -style windows" << 1 << "/usr/bin/appname";
QTest::newRow( "App name, style, arbitrary, reverse" ) << 5 << "/usr/bin/appname -style windows -arbitrary -reverse"
- << 2 << "/usr/bin/appname -arbitrary";
+ << 2 << "/usr/bin/appname -arbitrary";
}
void tst_QApplication::task109149()
@@ -489,14 +491,14 @@ static QString cstrings2QString( char **args )
{
QString string;
if ( !args )
- return string;
+ return string;
int i = 0;
while ( args[i] ) {
- string += args[i];
- if ( args[i+1] )
- string += " ";
- ++i;
+ string += args[i];
+ if ( args[i+1] )
+ string += " ";
+ ++i;
}
return string;
}
@@ -1949,7 +1951,7 @@ void tst_QApplication::windowsCommandLine_data()
void tst_QApplication::windowsCommandLine()
{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
QFETCH(QString, args);
QFETCH(QString, expected);
@@ -2305,6 +2307,22 @@ void tst_QApplication::abortQuitOnShow()
QCOMPARE(app.exec(), 1);
}
+void tst_QApplication::settableStyleHints()
+{
+ int argc = 0;
+ QApplication app(argc, 0);
+ QApplication::setCursorFlashTime(437);
+ QCOMPARE(QApplication::cursorFlashTime(), 437);
+ QApplication::setDoubleClickInterval(128);
+ QCOMPARE(QApplication::doubleClickInterval(), 128);
+ QApplication::setStartDragDistance(122000);
+ QCOMPARE(QApplication::startDragDistance(), 122000);
+ QApplication::setStartDragTime(834);
+ QCOMPARE(QApplication::startDragTime(), 834);
+ QApplication::setKeyboardInputInterval(309);
+ QCOMPARE(QApplication::keyboardInputInterval(), 309);
+}
+
/*
This test is meant to ensure that certain objects (public & commonly used)
can safely be used in a Q_GLOBAL_STATIC such that their destructors are
@@ -2314,7 +2332,9 @@ Q_GLOBAL_STATIC(QLocale, tst_qapp_locale);
#ifndef QT_NO_PROCESS
Q_GLOBAL_STATIC(QProcess, tst_qapp_process);
#endif
+#ifndef QT_NO_FILESYSTEMWATCHER
Q_GLOBAL_STATIC(QFileSystemWatcher, tst_qapp_fileSystemWatcher);
+#endif
#ifndef QT_NO_SHAREDMEMORY
Q_GLOBAL_STATIC(QSharedMemory, tst_qapp_sharedMemory);
#endif
@@ -2337,7 +2357,9 @@ void tst_QApplication::globalStaticObjectDestruction()
#ifndef QT_NO_PROCESS
QVERIFY(tst_qapp_process());
#endif
+#ifndef QT_NO_FILESYSTEMWATCHER
QVERIFY(tst_qapp_fileSystemWatcher());
+#endif
#ifndef QT_NO_SHAREDMEMORY
QVERIFY(tst_qapp_sharedMemory());
#endif
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index d04b812878..9df7e1662d 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -263,7 +263,7 @@ void tst_QFormLayout::wrapping()
{
QWidget *w = new QWidget;
QFormLayout *fl = new QFormLayout(w);
- fl->setRowWrapPolicy(QFormLayout::WrapLongRows);
+ fl->setRowWrapPolicy(QFormLayout::WrapLongRows);
QLineEdit *le = new QLineEdit;
QLabel *lbl = new QLabel("A long label");
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index e067b071e7..1003a9fb1f 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -974,8 +974,8 @@ QRect CustomLayoutStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_GroupBoxLayoutItem:
rect = opt->rect.adjusted(0, +10, 0, 0);
break;
- default:
- break;
+ default:
+ break;
}
}
if (rect.isNull())
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index 962fd3a8ab..306b049467 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -160,7 +160,7 @@ class TestEdit : public QTextEdit
Q_OBJECT
public:
TestEdit(QWidget *parent, const char *name)
- : QTextEdit(parent)
+ : QTextEdit(parent)
{
setObjectName(name);
}
@@ -231,13 +231,13 @@ Qt::KeyboardModifiers tst_QShortcut::toButtons( int key )
{
Qt::KeyboardModifiers result = Qt::NoModifier;
if ( key & Qt::SHIFT )
- result |= Qt::ShiftModifier;
+ result |= Qt::ShiftModifier;
if ( key & Qt::CTRL )
- result |= Qt::ControlModifier;
- if ( key & Qt::META )
- result |= Qt::MetaModifier;
- if ( key & Qt::ALT )
- result |= Qt::AltModifier;
+ result |= Qt::ControlModifier;
+ if ( key & Qt::META )
+ result |= Qt::MetaModifier;
+ if ( key & Qt::ALT )
+ result |= Qt::AltModifier;
return result;
}
@@ -291,15 +291,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
@@ -307,32 +307,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
@@ -340,14 +340,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
@@ -355,12 +355,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
@@ -368,15 +368,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
@@ -384,12 +384,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
@@ -400,11 +400,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
@@ -412,51 +412,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("N13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
}
// ------------------------------------------------------------------
@@ -478,15 +478,15 @@ void tst_QShortcut::text_data()
Shift + Qt::Key_Plus on Qt::Key_Pluss
Qt::Key_Plus on Qt::Key_Pluss
*/
- QTest::newRow("T001 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ 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 - slot2") << SetupAccel << TriggerSlot2 << QString("+") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ //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
@@ -496,44 +496,44 @@ void tst_QShortcut::text_data()
Shift + Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Pluss
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 - 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 - 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 - 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
/* Testing Single Sequences
Shift + Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Plus
Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Plus
- Qt::Key_Plus on Ctrl + Qt::Key_Plus
+ Qt::Key_Plus on Ctrl + Qt::Key_Plus
*/
- QTest::newRow("T002b - slot1") << SetupAccel << TriggerSlot1 << QString("Ctrl++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ 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
Qt::Key_F1 on Qt::Key_F1
*/
- QTest::newRow("T003 - slot1") << SetupAccel << TriggerSlot1 << QString("F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ 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 - 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
//===========================================
// [Shift + key] and [key] on shortcuts with
@@ -544,11 +544,11 @@ void tst_QShortcut::text_data()
Qt::Key_F1
Shift + Qt::Key_F1
*/
- 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 - 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
/* Testing Single Sequences
Qt::Key_M
@@ -556,22 +556,22 @@ void tst_QShortcut::text_data()
Ctrl + Qt::Key_M
Alt + Qt::Key_M
*/
- QTest::newRow("T01 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T02 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- 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("T01 - slot1") << SetupAccel << TriggerSlot1 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ QTest::newRow("T02 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
+ 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("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
/* Testing Single Specialkeys
Qt::Key_aring
@@ -581,26 +581,26 @@ void tst_QShortcut::text_data()
/* see comments above on the #ifdef'ery */
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("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
/* Testing Multiple Sequences
Qt::Key_M
Qt::Key_I, Qt::Key_M
Shift+Qt::Key_I, Qt::Key_M
*/
- 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("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
}
// ------------------------------------------------------------------
@@ -624,7 +624,7 @@ void tst_QShortcut::disabledItems()
QPushButton pb2(mainW);
pb1.setObjectName("pushbutton-1");
pb2.setObjectName("pushbutton-2");
- pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
+ pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
pb2.show();
QShortcut *cut1 = setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M");
@@ -700,21 +700,21 @@ void tst_QShortcut::disabledItems()
sendKeyEvents( Qt::CTRL+Qt::Key_Q, 0 );
QCOMPARE( currentResult, NoResult );
if (over_330)
- QCOMPARE( sbText, QString("Ctrl+K, Ctrl+Q not defined") );
+ 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 );
QCOMPARE( currentResult, NoResult );
if (over_330)
- QCOMPARE( sbText, QString::null );
+ QCOMPARE( sbText, QString::null );
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::null );
+ QCOMPARE( sbText, QString::null );
#endif
clearAllShortcuts();
cut1 = 0;
@@ -876,7 +876,7 @@ void tst_QShortcut::ambiguousItems()
QPushButton pb2(mainW);
pb1.setObjectName("pushbutton-1");
pb2.setObjectName("pushbutton-2");
- pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
+ pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
pb2.show();
setupShortcut(&pb1, "shortcut1-pb1", TriggerSlot1, "M");
@@ -915,7 +915,7 @@ void tst_QShortcut::unicodeCompare()
QPushButton pb2(mainW);
pb1.setObjectName("pushbutton-1");
pb2.setObjectName("pushbutton-2");
- pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
+ pb1.show(); // Must be show for QShortcutMap::correctSubWindow to trigger
pb2.show();
QKeySequence ks1("Ctrl+M"); // Unicode
@@ -1190,25 +1190,25 @@ void tst_QShortcut::sendKeyEvents(QWidget *w, int k1, QChar c1, int k2, QChar c2
if (k1 || c1.toLatin1()) {
QString c(c1.unicode() == QChar::Null ? QString() : QString(c1));
QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k1), c, b1);
- QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k1), c, b1);
+ QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k1), c, b1);
}
if (k2 || c2.toLatin1()) {
QString c(c2.unicode() == QChar::Null ? QString() : QString(c2));
- QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k2), c, b2);
- QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k2), c, b2);
+ QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k2), c, b2);
+ QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k2), c, b2);
}
if (k3 || c3.toLatin1()) {
QString c(c3.unicode() == QChar::Null ? QString() : QString(c3));
- QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k3), c, b3);
- QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k3), c, b3);
+ QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k3), c, b3);
+ QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k3), c, b3);
}
if (k4 || c4.toLatin1()) {
QString c(c4.unicode() == QChar::Null ? QString() : QString(c4));
- QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k4), c, b4);
- QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k4), c, b4);
+ QTest::sendKeyEvent(QTest::Press, w, static_cast<Qt::Key>(k4), c, b4);
+ QTest::sendKeyEvent(QTest::Release, w, static_cast<Qt::Key>(k4), c, b4);
}
}
@@ -1229,9 +1229,9 @@ void tst_QShortcut::testElement()
QFETCH(tst_QShortcut::Result, result);
if (action == ClearAll) {
- clearAllShortcuts();
+ clearAllShortcuts();
} else if (action == SetupAccel) {
- setupShortcut(testWidget, txt, k1, k2, k3, k4);
+ setupShortcut(testWidget, txt, k1, k2, k3, k4);
} else {
sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4);
QCOMPARE(currentResult, result);
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro
index a4fcde8a34..3eedfa1d3a 100644
--- a/tests/auto/widgets/kernel/qwidget/qwidget.pro
+++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro
@@ -20,7 +20,7 @@ x11 {
LIBS += $$QMAKE_LIBS_X11
}
-!wince*:win32: LIBS += -luser32 -lgdi32
+!wince*:win32:!winrt: LIBS += -luser32 -lgdi32
mac:CONFIG+=insignificant_test # QTBUG-25300, QTBUG-23695
linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC # QTBUG-30566 \ No newline at end of file
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 9090f97ce6..38b629cad7 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -117,11 +117,13 @@ static bool qt_wince_is_platform(const QString &platformString) {
}
static inline bool qt_wince_is_smartphone() { return qt_wince_is_platform(QString::fromLatin1("Smartphone")); }
# endif // Q_OS_WINCE_WM
-# else // Q_OS_WINCE
+# elif !defined(Q_OS_WINRT) // Q_OS_WINCE
# define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
QSKIP("desktop is not visible, this test would fail");
-# endif // !Q_OS_WINCE
+# else // !Q_OS_WINCE && !Q_OS_WINRT
+# define Q_CHECK_PAINTEVENTS
+# endif // Q_OS_WINRT
#else // Q_OS_WIN
# define Q_CHECK_PAINTEVENTS
#endif // else Q_OS_WIN
@@ -304,7 +306,7 @@ private slots:
void subtractOpaqueSiblings();
#endif
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void setGeometry_win();
#endif
@@ -374,7 +376,7 @@ private slots:
void quitOnCloseAttribute();
void moveRect();
-#if defined (Q_OS_WIN)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT)
void gdiPainting();
void paintOnScreenPossible();
#endif
@@ -592,7 +594,7 @@ void tst_QWidget::getSetCheck()
QCOMPARE(true, obj1.autoFillBackground());
var1.reset();
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
obj1.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
const HWND handle = reinterpret_cast<HWND>(obj1.winId()); // explicitly create window handle
QVERIFY(GetWindowLong(handle, GWL_STYLE) & WS_POPUP);
@@ -667,7 +669,7 @@ void tst_QWidget::cleanup()
// Helper class...
BezierViewer::BezierViewer( QWidget* parent)
- : QWidget( parent )
+ : QWidget(parent)
{
setObjectName(QLatin1String("TestWidget"));
setWindowTitle(objectName());
@@ -687,9 +689,9 @@ void BezierViewer::paintEvent( QPaintEvent* )
{
if ( points.size() != 4 ) {
#if defined(QT_CHECK_RANGE)
- qWarning( "QPolygon::bezier: The array must have 4 control points" );
+ qWarning( "QPolygon::bezier: The array must have 4 control points" );
#endif
- return;
+ return;
}
/* Calculate Bezier curve */
@@ -705,18 +707,18 @@ void BezierViewer::paintEvent( QPaintEvent* )
/* Scale Bezier curve vertices */
for ( QPolygonF::Iterator it = bezier.begin(); it != bezier.end(); ++it ) {
- it->setX( (it->x()-br.x()) * scl + border );
- it->setY( (it->y()-br.y()) * scl + border );
+ it->setX( (it->x()-br.x()) * scl + border );
+ it->setY( (it->y()-br.y()) * scl + border );
}
/* Draw grid */
painter.setPen( Qt::lightGray );
- int i;
- for ( i = border; i <= pr.width(); i += scl ) {
- painter.drawLine( i, 0, i, pr.height() );
+ int i;
+ for ( i = border; i <= pr.width(); i += scl ) {
+ painter.drawLine( i, 0, i, pr.height() );
}
for ( int j = border; j <= pr.height(); j += scl ) {
- painter.drawLine( 0, j, pr.width(), j );
+ painter.drawLine( 0, j, pr.width(), j );
}
/* Write number of vertices */
@@ -734,17 +736,17 @@ void BezierViewer::paintEvent( QPaintEvent* )
/* Scale and draw control points */
painter.setPen( Qt::darkGreen );
for ( QPolygonF::Iterator p1 = points.begin(); p1 != points.end(); ++p1 ) {
- int x = (p1->x()-br.x()) * scl + border;
- int y = (p1->y()-br.y()) * scl + border;
- painter.drawLine( x-4, y-4, x+4, y+4 );
- painter.drawLine( x+4, y-4, x-4, y+4 );
+ int x = (p1->x()-br.x()) * scl + border;
+ int y = (p1->y()-br.y()) * scl + border;
+ painter.drawLine( x-4, y-4, x+4, y+4 );
+ painter.drawLine( x+4, y-4, x-4, y+4 );
}
/* Draw vertices */
painter.setPen( Qt::red );
painter.setBrush( Qt::red );
for ( QPolygonF::Iterator p2 = bezier.begin(); p2 != bezier.end(); ++p2 )
- painter.drawEllipse( p2->x()-1, p2->y()-1, 3, 3 );
+ painter.drawEllipse( p2->x()-1, p2->y()-1, 3, 3 );
}
void tst_QWidget::fontPropagation()
@@ -1283,7 +1285,7 @@ void tst_QWidget::visible_setWindowOpacity()
testWidget->hide();
QVERIFY( !testWidget->isVisible() );
testWidget->setWindowOpacity(0.5);
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
QVERIFY(!::IsWindowVisible(winHandleOf(testWidget)));
#endif
testWidget->setWindowOpacity(1.0);
@@ -1675,17 +1677,17 @@ public:
Container()
{
box = new QVBoxLayout(this);
- //(new QVBoxLayout(this))->setAutoAdd(true);
+ //(new QVBoxLayout(this))->setAutoAdd(true);
}
void tab()
{
- focusNextPrevChild(true);
+ focusNextPrevChild(true);
}
void backTab()
{
- focusNextPrevChild(false);
+ focusNextPrevChild(false);
}
};
@@ -1710,7 +1712,7 @@ public:
setFocusProxy( lineEdit );
setFocusPolicy( Qt::StrongFocus );
- setTabOrder(lineEdit, button);
+ setTabOrder(lineEdit, button);
}
private:
@@ -1759,9 +1761,9 @@ void tst_QWidget::setTabOrder()
QTRY_VERIFY(lastEdit->hasFocus());
container.tab();
do {
- QVERIFY(comp[current]->focusProxy()->hasFocus());
- container.tab();
- current--;
+ QVERIFY(comp[current]->focusProxy()->hasFocus());
+ container.tab();
+ current--;
} while (current >= 0);
QVERIFY(firstEdit->hasFocus());
@@ -3623,7 +3625,7 @@ void tst_QWidget::optimizedResize_topLevel()
topLevel.partial = false;
topLevel.paintedRegion = QRegion();
-#ifndef Q_OS_WIN
+#if !defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)
topLevel.resize(topLevel.size() + QSize(10, 10));
#else
// Static contents does not work when programmatically resizing
@@ -4555,7 +4557,7 @@ void tst_QWidget::setWindowGeometry()
}
}
-#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
void tst_QWidget::setGeometry_win()
{
QWidget widget;
@@ -4573,7 +4575,7 @@ void tst_QWidget::setGeometry_win()
QVERIFY(rt.left <= 0);
QVERIFY(rt.top <= 0);
}
-#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE)
+#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
// Since X11 WindowManager operation are all async, and we have no way to know if the window
// manager has finished playing with the window geometry, this test can't be reliable on X11.
@@ -8118,7 +8120,7 @@ void tst_QWidget::moveRect()
child.move(10, 10); // Don't crash.
}
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
class GDIWidget : public QDialog
{
Q_OBJECT
@@ -8185,7 +8187,7 @@ void tst_QWidget::paintOnScreenPossible()
w2.setAttribute(Qt::WA_PaintOnScreen);
QVERIFY(w2.testAttribute(Qt::WA_PaintOnScreen));
}
-#endif // Q_OS_WIN
+#endif // Q_OS_WIN && !Q_OS_WINRT
void tst_QWidget::reparentStaticWidget()
{
diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
index 93262722b9..523fac940d 100644
--- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
+++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp
@@ -419,7 +419,7 @@ void tst_QAbstractButton::setIcon()
QPixmap p2( test2_xpm );
for ( int a = 0; a<5; a++ )
- testWidget->setIcon( p2 );
+ testWidget->setIcon( p2 );
QCOMPARE( testWidget->icon().pixmap(12, 8), p2 );
diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
index 14a8496b42..a3079cdaef 100644
--- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
+++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
@@ -185,7 +185,7 @@ void tst_QCalendarWidget::buttonClickCheck()
int month = object.monthShown();
QToolButton *button = object.findChild<QToolButton *>("qt_calendar_prevmonth");
QTest::mouseClick(button, Qt::LeftButton);
- QCOMPARE(month > 1 ? month-1 : 12, object.monthShown());
+ QCOMPARE(month > 1 ? month-1 : 12, object.monthShown());
button = object.findChild<QToolButton *>("qt_calendar_nextmonth");
QTest::mouseClick(button, Qt::LeftButton);
QCOMPARE(month, object.monthShown());
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index eabb7aaa17..509ccc37b6 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -162,6 +162,7 @@ private slots:
void highlightedSignal();
void itemData();
void task_QTBUG_31146_popupCompletion();
+ void keyboardSelection();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1848,7 +1849,7 @@ void tst_QComboBox::flaggedItems_data()
itemList << "nine" << "ten";
keyMovementList << Qt::Key_T;
- QTest::newRow(testCase.toLatin1() + "search same start letter") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 9;
+ QTest::newRow(testCase.toLatin1() + "search same start letter") << itemList << deselectFlagList << disableFlagList << keyMovementList << bool(editable) << 2;
keyMovementList.clear();
keyMovementList << Qt::Key_T << Qt::Key_H;
@@ -2946,5 +2947,32 @@ void tst_QComboBox::task_QTBUG_31146_popupCompletion()
QCOMPARE(comboBox.currentIndex(), 0);
}
+void tst_QComboBox::keyboardSelection()
+{
+ QComboBox comboBox;
+ const int keyboardInterval = QApplication::keyboardInputInterval();
+ QStringList list;
+ list << "OA" << "OB" << "OC" << "OO" << "OP" << "PP";
+ comboBox.addItems(list);
+
+ // Clear any remaining keyboard input from previous tests.
+ QTest::qWait(keyboardInterval);
+ QTest::keyClicks(&comboBox, "oo", Qt::NoModifier, 50);
+ QCOMPARE(comboBox.currentText(), list.at(3));
+
+ QTest::qWait(keyboardInterval);
+ QTest::keyClicks(&comboBox, "op", Qt::NoModifier, 50);
+ QCOMPARE(comboBox.currentText(), list.at(4));
+
+ QTest::keyClick(&comboBox, Qt::Key_P, Qt::NoModifier, keyboardInterval);
+ QCOMPARE(comboBox.currentText(), list.at(5));
+
+ QTest::keyClick(&comboBox, Qt::Key_O, Qt::NoModifier, keyboardInterval);
+ QCOMPARE(comboBox.currentText(), list.at(0));
+
+ QTest::keyClick(&comboBox, Qt::Key_O, Qt::NoModifier, keyboardInterval);
+ QCOMPARE(comboBox.currentText(), list.at(1));
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index bfffa357a8..ded3e55283 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -346,7 +346,7 @@ void tst_QDateTimeEdit::cleanupTestCase()
void tst_QDateTimeEdit::init()
{
QLocale::setDefault(QLocale(QLocale::C));
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
#endif
testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index a4ad18c7a6..6551a88232 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -87,7 +87,7 @@ private slots:
void task248604_infiniteResize();
void task258459_visibilityChanged();
void taskQTBUG_1665_closableChanged();
- void taskQTBUG_9758_undockedGeometry();
+ void taskQTBUG_9758_undockedGeometry();
};
// Testing get/set functions
@@ -588,7 +588,7 @@ void tst_QDockWidget::visibilityChanged()
QCOMPARE(spy.count(), 0);
mw.addDockWidget(Qt::RightDockWidgetArea, &dw2);
- QTest::qWait(200);
+ QTest::qWait(200);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toBool(), true);
}
@@ -758,19 +758,19 @@ void tst_QDockWidget::task169808_setFloating()
}
};
QMainWindow mw;
- mw.setCentralWidget(new MyWidget);
- QDockWidget *dw = new QDockWidget("my dock");
- dw->setWidget(new MyWidget);
- mw.addDockWidget(Qt::LeftDockWidgetArea, dw);
- dw->setFloating(true);
- mw.show();
+ mw.setCentralWidget(new MyWidget);
+ QDockWidget *dw = new QDockWidget("my dock");
+ dw->setWidget(new MyWidget);
+ mw.addDockWidget(Qt::LeftDockWidgetArea, dw);
+ dw->setFloating(true);
+ mw.show();
QVERIFY(QTest::qWaitForWindowExposed(&mw));
QCOMPARE(dw->widget()->size(), dw->widget()->sizeHint());
//and now we try to test if the contents margin is taken into account
dw->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
- dw->setFloating(false);
+ dw->setFloating(false);
QVERIFY(QTest::qWaitForWindowExposed(&mw));
qApp->processEvents(); //leave time processing events
diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
index b880ebe078..6784ee477b 100644
--- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -145,6 +145,9 @@ private slots:
void taskQTBUG_6670_selectAllWithPrefix();
void taskQTBUG_6496_fiddlingWithPrecision();
+ void setGroupSeparatorShown_data();
+ void setGroupSeparatorShown();
+
public slots:
void valueChangedHelper(const QString &);
void valueChangedHelper(double);
@@ -156,6 +159,9 @@ private:
typedef QList<double> DoubleList;
+Q_DECLARE_METATYPE(QLocale::Language)
+Q_DECLARE_METATYPE(QLocale::Country)
+
tst_QDoubleSpinBox::tst_QDoubleSpinBox()
{
@@ -634,7 +640,7 @@ void tst_QDoubleSpinBox::setDecimals()
QTest::keyClick(&spin, Qt::Key_1);
QTest::keyClick(&spin, Qt::Key_1);
QTest::keyClick(&spin, Qt::Key_1);
- if (sizeof(qreal) == sizeof(float))
+ if (sizeof(qreal) == sizeof(float))
QCOMPARE(spin.text().left(17), expected.left(17));
else
QCOMPARE(spin.text(), expected);
@@ -1099,5 +1105,45 @@ void tst_QDoubleSpinBox::taskQTBUG_6496_fiddlingWithPrecision()
QCOMPARE(dsb.maximum(), 0.991);
}
+void tst_QDoubleSpinBox::setGroupSeparatorShown_data()
+{
+ QTest::addColumn<QLocale::Language>("lang");
+ QTest::addColumn<QLocale::Country>("country");
+
+ QTest::newRow("data0") << QLocale::English << QLocale::UnitedStates;
+ QTest::newRow("data1") << QLocale::Swedish << QLocale::Sweden;
+ QTest::newRow("data2") << QLocale::German << QLocale::Germany;
+ QTest::newRow("data3") << QLocale::Georgian << QLocale::Georgia;
+ QTest::newRow("data3") << QLocale::Macedonian << QLocale::Macedonia;
+}
+
+void tst_QDoubleSpinBox::setGroupSeparatorShown()
+{
+ QFETCH(QLocale::Language, lang);
+ QFETCH(QLocale::Country, country);
+
+ QLocale loc(lang, country);
+ QLocale::setDefault(loc);
+ DoubleSpinBox spinBox;
+ spinBox.setMaximum(99999999);
+ spinBox.setValue(1300000.00);
+ spinBox.setGroupSeparatorShown(true);
+ QCOMPARE(spinBox.lineEdit()->text(), spinBox.locale().toString(1300000.00, 'f', 2));
+ QCOMPARE(spinBox.isGroupSeparatorShown(), true);
+ QCOMPARE(spinBox.textFromValue(23421),spinBox.locale().toString(23421.00, 'f', 2));
+
+ spinBox.setGroupSeparatorShown(false);
+ QCOMPARE(spinBox.lineEdit()->text(), spinBox.locale().toString(1300000.00, 'f', 2).remove(
+ spinBox.locale().groupSeparator()));
+ QCOMPARE(spinBox.isGroupSeparatorShown(), false);
+
+ spinBox.setMaximum(72000);
+ spinBox.lineEdit()->setText(spinBox.locale().toString(32000.64, 'f', 2));
+ QCOMPARE(spinBox.value()+1000, 33000.64);
+
+ spinBox.lineEdit()->setText(spinBox.locale().toString(32000.44, 'f', 2));
+ QCOMPARE(spinBox.value()+1000, 33000.44);
+}
+
QTEST_MAIN(tst_QDoubleSpinBox)
#include "tst_qdoublespinbox.moc"
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index 2fd15b891a..e3aa7fda51 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -189,9 +189,9 @@ void tst_QLabel::init()
void tst_QLabel::cleanup()
{
if (QTest::currentTestFunction() == QLatin1String("setBuddy")) {
- testWidget->show();
+ testWidget->show();
- delete test_box; // this should delete tst_labl and test_edit as well.
+ delete test_box; // this should delete tst_labl and test_edit as well.
}
}
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index a9f5cb686c..45167bac60 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -53,7 +53,7 @@
#include "qstandarditemmodel.h"
#include <qpa/qplatformtheme.h>
#include "qstylehints.h"
-#include <private/qguiapplication_p.h>
+#include <private/qapplication_p.h>
#include "qclipboard.h"
#ifdef Q_OS_MAC
@@ -71,6 +71,7 @@
#include <qstringlistmodel.h>
#include <qsortfilterproxymodel.h>
#include <qdebug.h>
+#include <qscreen.h>
#include "qcommonstyle.h"
#include "qstyleoption.h"
@@ -87,6 +88,17 @@ QT_BEGIN_NAMESPACE
class QPainter;
QT_END_NAMESPACE
+static inline void centerOnScreen(QWidget *w, const QSize &size)
+{
+ const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
+ w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
+}
+
+static inline void centerOnScreen(QWidget *w)
+{
+ centerOnScreen(w, w->geometry().size());
+}
+
class StyleOptionTestStyle : public QCommonStyle
{
private:
@@ -300,6 +312,9 @@ private slots:
void clearButton();
void sideWidgets();
+ void shouldShowPlaceholderText_data();
+ void shouldShowPlaceholderText();
+
protected slots:
void editingFinished();
@@ -313,6 +328,7 @@ private:
// keyClicks(..) is moved to QtTestCase
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
+ QLineEdit *ensureTestWidget();
bool validInput;
QString changed_string;
@@ -322,7 +338,7 @@ private:
int selection_count;
int lastCursorPos;
int newCursorPos;
- QLineEdit *testWidget;
+ QLineEdit *m_testWidget;
int m_keyboardScheme;
PlatformInputContext m_platformInputContext;
};
@@ -351,7 +367,7 @@ void tst_QLineEdit::getSetCheck()
QCOMPARE(true, obj1.dragEnabled());
}
-tst_QLineEdit::tst_QLineEdit() : validInput(false), m_keyboardScheme(0)
+tst_QLineEdit::tst_QLineEdit() : validInput(false), m_testWidget(0), m_keyboardScheme(0)
{
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt();
@@ -367,23 +383,24 @@ tst_QLineEdit::~tst_QLineEdit()
{
}
+QLineEdit *tst_QLineEdit::ensureTestWidget()
+{
+ if (!m_testWidget) {
+ m_testWidget = new QLineEdit;
+ m_testWidget->setObjectName("testWidget");
+ connect(m_testWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onCursorPositionChanged(int,int)));
+ connect(m_testWidget, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString)));
+ connect(m_testWidget, SIGNAL(textEdited(QString)), this, SLOT(onTextEdited(QString)));
+ connect(m_testWidget, SIGNAL(returnPressed()), this, SLOT(onReturnPressed()));
+ connect(m_testWidget, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+ connect(m_testWidget, SIGNAL(editingFinished()), this, SLOT(editingFinished()));
+ m_testWidget->resize(200,50);
+ }
+ return m_testWidget;
+}
+
void tst_QLineEdit::initTestCase()
{
- testWidget = new QLineEdit(0);
- testWidget->setObjectName("testWidget");
- connect(testWidget, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(onCursorPositionChanged(int,int)));
- connect(testWidget, SIGNAL(textChanged(QString)), this, SLOT(onTextChanged(QString)));
- connect(testWidget, SIGNAL(textEdited(QString)), this, SLOT(onTextEdited(QString)));
- connect(testWidget, SIGNAL(returnPressed()), this, SLOT(onReturnPressed()));
- connect(testWidget, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
- connect(testWidget, SIGNAL(editingFinished()), this, SLOT(editingFinished()));
-
- testWidget->resize(200,50);
- testWidget->show();
- QVERIFY(QTest::qWaitForWindowExposed(testWidget));
- QApplication::setActiveWindow(testWidget);
- QTRY_VERIFY(testWidget->hasFocus());
-
changed_count = 0;
edited_count = 0;
selection_count = 0;
@@ -394,7 +411,6 @@ void tst_QLineEdit::initTestCase()
void tst_QLineEdit::cleanupTestCase()
{
- delete testWidget;
QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
inputMethodPrivate->testContext = 0;
}
@@ -402,23 +418,17 @@ void tst_QLineEdit::cleanupTestCase()
void tst_QLineEdit::init()
{
return_count = 0;
- testWidget->clear();
- testWidget->setEchoMode(QLineEdit::Normal);
- testWidget->setMaxLength(32767);
- testWidget->setReadOnly(false);
- testWidget->setText("");
- testWidget->setInputMask("");
- testWidget->setFrame(true);
- testWidget->setValidator(0);
- testWidget->setDragEnabled(true);
}
void tst_QLineEdit::cleanup()
{
+ delete m_testWidget;
+ m_testWidget = 0;
}
void tst_QLineEdit::experimental()
{
+ QLineEdit *testWidget = ensureTestWidget();
QIntValidator intValidator(3, 7, 0);
testWidget->setValidator(&intValidator);
testWidget->setText("");
@@ -436,8 +446,7 @@ void tst_QLineEdit::experimental()
void tst_QLineEdit::upperAndLowercase()
{
- testWidget->setInputMask("");
- testWidget->setText("");
+ QLineEdit *testWidget = ensureTestWidget();
QTest::keyClicks(testWidget, "aAzZ`1234567890-=~!@#$%^&*()_+[]{}\\|;:'\",.<>/?");
qApp->processEvents();
@@ -659,6 +668,7 @@ void tst_QLineEdit::setInputMask()
QEXPECT_FAIL( "insert blank=input", "To eat blanks or not? Known issue. Task 43172", Abort);
// First set the input mask
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask(mask);
// then either insert using insert() or keyboard
@@ -702,12 +712,14 @@ void tst_QLineEdit::inputMask()
QFETCH(QString, mask);
QFETCH(QString, expectedMask);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask(mask);
QCOMPARE(testWidget->inputMask(), expectedMask);
}
void tst_QLineEdit::clearInputMask()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask("000.000.000.000");
QVERIFY(testWidget->inputMask() != QString::null);
testWidget->setInputMask(QString::null);
@@ -789,6 +801,7 @@ void tst_QLineEdit::keypress_inputMask()
QFETCH(QString, expectedText);
QFETCH(QString, expectedDisplayText);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask(mask);
keys.simulate(testWidget);
@@ -825,6 +838,7 @@ void tst_QLineEdit::hasAcceptableInputMask()
QFETCH(QString, valid);
// test that invalid input (for required) work for optionalMask
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask(optionalMask);
validInput = false;
testWidget->setText(invalid);
@@ -876,6 +890,7 @@ public:
void tst_QLineEdit::hasAcceptableInputValidator()
{
+ QLineEdit *testWidget = ensureTestWidget();
QSignalSpy spyChanged(testWidget, SIGNAL(textChanged(QString)));
QSignalSpy spyEdited(testWidget, SIGNAL(textEdited(QString)));
@@ -926,6 +941,7 @@ void tst_QLineEdit::maskCharacter()
QFETCH(QString, input);
QFETCH(bool, expectedValid);
+ QLineEdit *testWidget = ensureTestWidget();
QFocusEvent lostFocus(QEvent::FocusOut);
testWidget->setInputMask(mask);
@@ -1076,6 +1092,7 @@ void tst_QLineEdit::undo()
QFETCH(QStringList, expectedString);
QFETCH(bool, use_keys);
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(!testWidget->isUndoAvailable());
int i;
@@ -1167,6 +1184,7 @@ void tst_QLineEdit::redo()
QFETCH(IntList, insertIndex);
QFETCH(QStringList, expectedString);
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(!testWidget->isUndoAvailable());
QVERIFY(!testWidget->isRedoAvailable());
@@ -1436,6 +1454,7 @@ void tst_QLineEdit::undo_keypressevents()
QFETCH(QTestEventList, keys);
QFETCH(QStringList, expectedString);
+ QLineEdit *testWidget = ensureTestWidget();
keys.simulate(testWidget);
for (int i=0; i<expectedString.size(); ++i) {
@@ -1449,7 +1468,7 @@ void tst_QLineEdit::undo_keypressevents()
void tst_QLineEdit::QTBUG5786_undoPaste()
{
if (!PlatformClipboard::isAvailable())
- QSKIP("this machine doesn't support the clipboard");
+ QSKIP("this machine doesn't support the clipboard");
QString initial("initial");
QString string("test");
QString additional("add");
@@ -1480,6 +1499,7 @@ void tst_QLineEdit::QTBUG5786_undoPaste()
void tst_QLineEdit::clear()
{
// checking that clear of empty/nullstring doesn't add to undo history
+ QLineEdit *testWidget = ensureTestWidget();
int max = 5000;
while (max > 0 && testWidget->isUndoAvailable()) {
max--;
@@ -1501,7 +1521,7 @@ void tst_QLineEdit::clear()
void tst_QLineEdit::editingFinished()
{
- if (testWidget->hasAcceptableInput())
+ if (m_testWidget->hasAcceptableInput())
validInput = true;
else
validInput = false;
@@ -1523,6 +1543,7 @@ void tst_QLineEdit::text_data()
void tst_QLineEdit::text()
{
QFETCH(QString, insertString);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText(insertString);
QCOMPARE(testWidget->text(), insertString);
}
@@ -1537,6 +1558,7 @@ void tst_QLineEdit::textMask_data()
void tst_QLineEdit::textMask()
{
QFETCH( QString, insertString );
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask( "#" );
testWidget->setText( insertString );
QCOMPARE( testWidget->text(), insertString );
@@ -1544,6 +1566,7 @@ void tst_QLineEdit::textMask()
void tst_QLineEdit::setText()
{
+ QLineEdit *testWidget = ensureTestWidget();
QSignalSpy editedSpy(testWidget, SIGNAL(textEdited(QString)));
QSignalSpy changedSpy(testWidget, SIGNAL(textChanged(QString)));
testWidget->setText("hello");
@@ -1613,7 +1636,7 @@ void tst_QLineEdit::displayText_data()
m << bool(use_setText);
s = key_mode_str + "Password";
m = QLineEdit::Password;
- QChar passChar = qApp->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, 0, testWidget);
+ QChar passChar = qApp->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, 0, m_testWidget);
QString input;
QString pass;
input = "Hello World";
@@ -1645,6 +1668,7 @@ void tst_QLineEdit::displayText()
QFETCH(QLineEdit::EchoMode, mode);
//QFETCH(bool, use_setText); Currently unused.
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setEchoMode(mode);
testWidget->setText(insertString);
QCOMPARE(testWidget->displayText(), expectedString);
@@ -1654,11 +1678,15 @@ void tst_QLineEdit::displayText()
void tst_QLineEdit::passwordEchoOnEdit()
{
QStyleOptionFrameV2 opt;
+ QLineEdit *testWidget = ensureTestWidget();
QChar fillChar = testWidget->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, testWidget);
testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
testWidget->setFocus();
+ centerOnScreen(testWidget);
+ testWidget->show();
testWidget->raise();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget));
QTRY_VERIFY(testWidget->hasFocus());
QTest::keyPress(testWidget, '0');
@@ -1683,6 +1711,7 @@ void tst_QLineEdit::passwordEchoOnEdit()
void tst_QLineEdit::passwordEchoDelay()
{
+ QLineEdit *testWidget = ensureTestWidget();
int delay = qGuiApp->styleHints()->passwordMaskDelay();
#if defined QT_BUILD_INTERNAL
QLineEditPrivate *priv = QLineEditPrivate::get(testWidget);
@@ -1698,7 +1727,10 @@ void tst_QLineEdit::passwordEchoDelay()
testWidget->setEchoMode(QLineEdit::Password);
testWidget->setFocus();
+ centerOnScreen(testWidget);
+ testWidget->show();
testWidget->raise();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget));
QTRY_VERIFY(testWidget->hasFocus());
QTest::keyPress(testWidget, '0');
@@ -1757,6 +1789,7 @@ void tst_QLineEdit::maxLength_mask()
QFETCH(QString, mask);
QFETCH(int, expectedLength);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask(mask);
QCOMPARE(testWidget->maxLength(), expectedLength);
@@ -1789,6 +1822,7 @@ void tst_QLineEdit::maxLength()
QFETCH(bool, use_setText);
// in some cases we set the maxLength _before_ entering the text.
+ QLineEdit *testWidget = ensureTestWidget();
if (!insertBeforeSettingMaxLength)
testWidget->setMaxLength(length);
@@ -1820,6 +1854,7 @@ void tst_QLineEdit::maxLength()
void tst_QLineEdit::isReadOnly()
{
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(!testWidget->isReadOnly());
// start with a basic text
@@ -1863,6 +1898,7 @@ void tst_QLineEdit::noCursorBlinkWhenReadOnly()
if (cursorFlashTime == 0)
return;
BlinkTestLineEdit le;
+ centerOnScreen(&le);
le.show();
le.setFocus();
QTest::qWaitForWindowActive(&le);
@@ -1928,6 +1964,7 @@ void tst_QLineEdit::psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardMo
void tst_QLineEdit::cursorPosition()
{
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(testWidget->cursorPosition() == 0);
// start with a basic text
@@ -2015,7 +2052,7 @@ void tst_QLineEdit::cursorPositionChanged_data()
QTestEventList keys;
keys.addKeyClick(Qt::Key_A);
- QTest::newRow("a") << keys << 0 << 1;
+ QTest::newRow("a") << keys << -1 << 1;
keys.clear();
keys.addKeyClick(Qt::Key_A);
@@ -2146,6 +2183,7 @@ void tst_QLineEdit::cursorPositionChanged()
lastCursorPos = 0;
newCursorPos = 0;
+ QLineEdit *testWidget = ensureTestWidget();
input.simulate(testWidget);
QCOMPARE(lastCursorPos, lastPos);
QCOMPARE(newCursorPos, newPos);
@@ -2156,6 +2194,7 @@ void tst_QLineEdit::selectedText()
QString testString = "Abc defg hijklmno, p 'qrst' uvw xyz";
// start with a basic text
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText(testString);
selection_count = 0;
@@ -2225,6 +2264,7 @@ void tst_QLineEdit::textChangedAndTextEdited()
changed_count = 0;
edited_count = 0;
+ QLineEdit *testWidget = ensureTestWidget();
QTest::keyClick(testWidget, Qt::Key_A);
QCOMPARE(changed_count, 1);
QVERIFY(edited_count == changed_count);
@@ -2283,6 +2323,7 @@ void tst_QLineEdit::returnPressed()
{
return_count = 0;
+ QLineEdit *testWidget = ensureTestWidget();
QTest::keyClick(testWidget, Qt::Key_Return);
QVERIFY(return_count == 1);
return_count = 0;
@@ -2431,6 +2472,7 @@ void tst_QLineEdit::returnPressed_maskvalidator()
QFETCH(bool, returnPressed);
QEXPECT_FAIL("mask '999', intfix validator(0,999), input '12<cr>'", "QIntValidator has changed behaviour. Does not accept spaces. Task 43082.", Abort);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMask(inputMask);
if (hasValidator)
@@ -2451,6 +2493,7 @@ void tst_QLineEdit::onReturnPressed()
void tst_QLineEdit::setValidator()
{
// Verify that we can set and re-set a validator.
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(!testWidget->validator());
QIntValidator iv1(0);
@@ -2601,6 +2644,7 @@ void tst_QLineEdit::setValidator_QIntValidator()
QFETCH(bool, is_valid);
QIntValidator intValidator(mini, maxi, 0);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setValidator(&intValidator);
QVERIFY(testWidget->text().isEmpty());
//qDebug("1 input: '" + input + "' Exp: '" + expectedText + "'");
@@ -2637,6 +2681,7 @@ void tst_QLineEdit::frame_data()
void tst_QLineEdit::frame()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setFrame(false);
// verify that the editor is shown without a frame
#ifndef NO_PIXMAP_TESTS
@@ -2674,6 +2719,7 @@ void tst_QLineEdit::setAlignment_data()
void tst_QLineEdit::setAlignment()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText("left");
testWidget->setAlignment(Qt::AlignLeft);
#ifndef NO_PIXMAP_TESTS
@@ -2713,6 +2759,7 @@ void tst_QLineEdit::setAlignment()
void tst_QLineEdit::isModified()
{
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(!testWidget->isModified());
testWidget->setText("bla");
QVERIFY(!testWidget->isModified());
@@ -2747,6 +2794,7 @@ void tst_QLineEdit::isModified()
void tst_QLineEdit::edited()
{
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(!testWidget->isModified());
testWidget->setText("bla");
QVERIFY(!testWidget->isModified());
@@ -2778,6 +2826,7 @@ void tst_QLineEdit::edited()
void tst_QLineEdit::insert()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->insert("This");
testWidget->insert(" is");
testWidget->insert(" a");
@@ -2854,6 +2903,7 @@ void tst_QLineEdit::setSelection()
QFETCH(QString, expectedText);
QFETCH(bool, expectedHasSelectedText);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText(text);
testWidget->setSelection(start, length);
QCOMPARE(testWidget->hasSelectedText(), expectedHasSelectedText);
@@ -2869,6 +2919,7 @@ void tst_QLineEdit::cut()
QSKIP("Autotests run from cron and pasteboard don't get along quite ATM");
// test newlines in cut'n'paste
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText("A\nB\nC\n");
testWidget->setSelection(0, 6);
testWidget->cut();
@@ -2964,6 +3015,7 @@ void tst_QLineEdit::inputMaskAndValidator()
QFETCH(QString, validateText);
QFETCH(int, validatePos);
+ QLineEdit *testWidget = ensureTestWidget();
InputMaskValidator imv(testWidget);
testWidget->setValidator(&imv);
@@ -2977,6 +3029,7 @@ void tst_QLineEdit::inputMaskAndValidator()
void tst_QLineEdit::maxLengthAndInputMask()
{
// Really a test for #30447
+ QLineEdit *testWidget = ensureTestWidget();
QVERIFY(testWidget->inputMask().isNull());
testWidget->setMaxLength(10);
QVERIFY(testWidget->maxLength() == 10);
@@ -3016,6 +3069,7 @@ Q_DECLARE_METATYPE(LineEdit::State);
void tst_QLineEdit::returnPressedKeyEvent()
{
LineEdit lineedit;
+ centerOnScreen(&lineedit);
lineedit.show();
QCOMPARE((int)lineedit.state, (int)LineEdit::Other);
QTest::keyClick(&lineedit, Qt::Key_Enter);
@@ -3032,6 +3086,7 @@ void tst_QLineEdit::returnPressedKeyEvent()
void tst_QLineEdit::keepSelectionOnTabFocusIn()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText("hello world");
{
QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason);
@@ -3049,6 +3104,7 @@ void tst_QLineEdit::keepSelectionOnTabFocusIn()
void tst_QLineEdit::readOnlyStyleOption()
{
+ QLineEdit *testWidget = ensureTestWidget();
bool wasReadOnly = testWidget->isReadOnly();
QStyle *oldStyle = testWidget->style();
@@ -3071,6 +3127,7 @@ void tst_QLineEdit::readOnlyStyleOption()
void tst_QLineEdit::validateOnFocusOut()
{
+ QLineEdit *testWidget = ensureTestWidget();
QSignalSpy editingFinishedSpy(testWidget, SIGNAL(editingFinished()));
testWidget->setValidator(new QIntValidator(100, 999, 0));
QTest::keyPress(testWidget, '1');
@@ -3080,8 +3137,11 @@ void tst_QLineEdit::validateOnFocusOut()
QCOMPARE(editingFinishedSpy.count(), 0);
testWidget->setFocus();
+ centerOnScreen(testWidget);
+ testWidget->show();
testWidget->activateWindow();
- QTRY_VERIFY(testWidget->hasFocus());
+ QVERIFY(QTest::qWaitForWindowActive(testWidget));
+ QVERIFY(testWidget->hasFocus());
QTest::keyPress(testWidget, '0');
QTRY_COMPARE(testWidget->text(), QString("100"));
@@ -3092,6 +3152,7 @@ void tst_QLineEdit::validateOnFocusOut()
void tst_QLineEdit::editInvalidText()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->clear();
testWidget->setValidator(new QIntValidator(0, 120, 0));
testWidget->setText("1234");
@@ -3119,6 +3180,7 @@ void tst_QLineEdit::editInvalidText()
void tst_QLineEdit::charWithAltOrCtrlModifier()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->clear();
QCOMPARE(testWidget->text(), QString(""));
QTest::keyPress(testWidget, Qt::Key_Plus);
@@ -3133,6 +3195,7 @@ void tst_QLineEdit::charWithAltOrCtrlModifier()
void tst_QLineEdit::leftKeyOnSelectedText()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->clear();
testWidget->setText("0123");
testWidget->setCursorPosition(4);
@@ -3155,6 +3218,7 @@ void tst_QLineEdit::leftKeyOnSelectedText()
void tst_QLineEdit::inlineCompletion()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->clear();
QStandardItemModel *model = new QStandardItemModel;
QStandardItem *root = model->invisibleRootItem();
@@ -3169,6 +3233,9 @@ void tst_QLineEdit::inlineCompletion()
QCompleter *completer = new QCompleter(model);
completer->setCompletionMode(QCompleter::InlineCompletion);
completer->setCaseSensitivity(Qt::CaseInsensitive);
+ centerOnScreen(testWidget);
+ testWidget->show();
+ QTest::qWaitForWindowExposed(testWidget);
testWidget->setFocus();
QTRY_COMPARE(qApp->activeWindow(), (QWidget*)testWidget);
testWidget->setCompleter(completer);
@@ -3235,6 +3302,7 @@ void tst_QLineEdit::inlineCompletion()
void tst_QLineEdit::noTextEditedOnClear()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText("Test");
QSignalSpy textEditedSpy(testWidget, SIGNAL(textEdited(QString)));
testWidget->clear();
@@ -3298,6 +3366,7 @@ void tst_QLineEdit::textMargin()
sizeHint.setHeight(sizeHint.height() + top +bottom);
QCOMPARE(testWidget.sizeHint(), sizeHint);
testWidget.setFrame(false);
+ centerOnScreen(&tlw);
tlw.show();
int l;
@@ -3317,6 +3386,7 @@ void tst_QLineEdit::textMargin()
#ifndef QTEST_NO_CURSOR
void tst_QLineEdit::cursor()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setReadOnly(false);
QCOMPARE(testWidget->cursor().shape(), Qt::IBeamCursor);
testWidget->setReadOnly(true);
@@ -3556,12 +3626,16 @@ void tst_QLineEdit::task233101_cursorPosAfterInputMethod()
void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode()
{
QStyleOptionFrameV2 opt;
+ QLineEdit *testWidget = ensureTestWidget();
QChar fillChar = testWidget->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, testWidget);
testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
testWidget->setFocus();
+ centerOnScreen(testWidget);
+ testWidget->show();
QApplication::setActiveWindow(testWidget);
- QTRY_VERIFY(testWidget->hasFocus());
+ QVERIFY(QTest::qWaitForWindowActive(testWidget));
+ QVERIFY(testWidget->hasFocus());
QTest::keyPress(testWidget, '0');
QCOMPARE(testWidget->displayText(), QString("0"));
@@ -3585,6 +3659,7 @@ void tst_QLineEdit::task241436_passwordEchoOnEditRestoreEchoMode()
void tst_QLineEdit::task248948_redoRemovedSelection()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText("a");
testWidget->selectAll();
QTest::keyPress(testWidget, Qt::Key_Delete);
@@ -3599,12 +3674,15 @@ void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword()
{
QString password("Wanna guess?");
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText(password);
testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
testWidget->setFocus();
testWidget->selectAll();
+ centerOnScreen(testWidget);
+ testWidget->show();
QApplication::setActiveWindow(testWidget);
- QTRY_VERIFY(testWidget->hasFocus());
+ QVERIFY(QTest::qWaitForWindowActive(testWidget));
QTest::keyPress(testWidget, Qt::Key_Enter);
QTRY_COMPARE(testWidget->text(), password);
@@ -3614,6 +3692,7 @@ void tst_QLineEdit::taskQTBUG_4679_moveToStartEndOfBlock()
{
#ifdef Q_OS_MAC
const QString text("there are no blocks for lineEdit");
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText(text);
testWidget->setCursorPosition(5);
QCOMPARE(testWidget->cursorPosition(), 5);
@@ -3629,6 +3708,7 @@ void tst_QLineEdit::taskQTBUG_4679_selectToStartEndOfBlock()
{
#ifdef Q_OS_MAC
const QString text("there are no blocks for lineEdit, select all");
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText(text);
testWidget->setCursorPosition(5);
QCOMPARE(testWidget->cursorPosition(), 5);
@@ -3898,6 +3978,7 @@ void tst_QLineEdit::bidiLogicalMovement()
void tst_QLineEdit::selectAndCursorPosition()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText("This is a long piece of text");
testWidget->setSelection(0, 5);
@@ -3908,6 +3989,10 @@ void tst_QLineEdit::selectAndCursorPosition()
void tst_QLineEdit::inputMethod()
{
+ QLineEdit *testWidget = ensureTestWidget();
+ centerOnScreen(testWidget);
+ testWidget->show();
+ QVERIFY(QTest::qWaitForWindowExposed(testWidget));
// widget accepts input
QInputMethodQueryEvent queryEvent(Qt::ImEnabled);
QApplication::sendEvent(testWidget, &queryEvent);
@@ -3942,6 +4027,7 @@ void tst_QLineEdit::inputMethod()
void tst_QLineEdit::inputMethodSelection()
{
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
testWidget->setSelection(0,0);
QSignalSpy selectionSpy(testWidget, SIGNAL(selectionChanged()));
@@ -3989,6 +4075,7 @@ void tst_QLineEdit::inputMethodQueryImHints_data()
void tst_QLineEdit::inputMethodQueryImHints()
{
QFETCH(Qt::InputMethodHints, hints);
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setInputMethodHints(hints);
QVariant value = testWidget->inputMethodQuery(Qt::ImHints);
@@ -4031,7 +4118,7 @@ void tst_QLineEdit::undoRedoAndEchoModes()
QFETCH(QStringList, expected);
// create some history for the QLineEdit
- testWidget->clear();
+ QLineEdit *testWidget = ensureTestWidget();
testWidget->setEchoMode(QLineEdit::EchoMode(echoMode));
testWidget->insert(input.at(0));
testWidget->selectAll();
@@ -4136,5 +4223,59 @@ void tst_QLineEdit::sideWidgets()
lineEdit->addAction(iconAction);
}
+Q_DECLARE_METATYPE(Qt::AlignmentFlag)
+void tst_QLineEdit::shouldShowPlaceholderText_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<bool>("hasFocus");
+ QTest::addColumn<Qt::AlignmentFlag>("alignment");
+ QTest::addColumn<bool>("shouldShowPlaceholderText");
+
+ QTest::newRow("empty, non-focused, left") << QString() << false << Qt::AlignLeft << true;
+ QTest::newRow("empty, focused, left") << QString() << true << Qt::AlignLeft << true;
+ QTest::newRow("non-empty, non-focused, left") << QStringLiteral("Qt") << false << Qt::AlignLeft << false;
+ QTest::newRow("non-empty, focused, left") << QStringLiteral("Qt") << true << Qt::AlignLeft << false;
+
+ QTest::newRow("empty, non-focused, center") << QString() << false << Qt::AlignHCenter << true;
+ QTest::newRow("empty, focused, center") << QString() << true << Qt::AlignHCenter << false;
+ QTest::newRow("non-empty, non-focused, center") << QStringLiteral("Qt") << false << Qt::AlignHCenter << false;
+ QTest::newRow("non-empty, focused, center") << QStringLiteral("Qt") << true << Qt::AlignHCenter << false;
+
+ QTest::newRow("empty, non-focused, right") << QString() << false << Qt::AlignRight << true;
+ QTest::newRow("empty, focused, right") << QString() << true << Qt::AlignRight << true;
+ QTest::newRow("non-empty, non-focused, right") << QStringLiteral("Qt") << false << Qt::AlignRight << false;
+ QTest::newRow("non-empty, focused, right") << QStringLiteral("Qt") << true << Qt::AlignRight << false;
+}
+
+void tst_QLineEdit::shouldShowPlaceholderText()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("This test requires a developer build.");
+#else
+ QFETCH(QString, text);
+ QFETCH(bool, hasFocus);
+ QFETCH(Qt::AlignmentFlag, alignment);
+ QFETCH(bool, shouldShowPlaceholderText);
+
+ QLineEdit lineEdit;
+
+ // avoid "Test input context to commit without focused object" warnings
+ lineEdit.setAttribute(Qt::WA_InputMethodEnabled, false);
+
+ if (hasFocus) {
+ lineEdit.show();
+ QApplicationPrivate::setFocusWidget(&lineEdit, Qt::NoFocusReason);
+ }
+ QCOMPARE(lineEdit.hasFocus(), hasFocus);
+
+ lineEdit.setText(text);
+ lineEdit.setAlignment(alignment);
+
+ QLineEditPrivate *priv = QLineEditPrivate::get(&lineEdit);
+ QCOMPARE(priv->shouldShowPlaceholderText(), shouldShowPlaceholderText);
+#endif
+
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index e5a9b570bb..d02b86bd8a 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -1340,8 +1340,8 @@ void tst_QMainWindow::restoreStateFromPreviousVersion()
QCOMPARE(win.restoreState(ba), true);
for( int i = 0; i < docks.size(); ++i) {
- QCOMPARE( win.dockWidgetArea(docks[i]), Qt::DockWidgetArea(1 << i%4));
- }
+ QCOMPARE( win.dockWidgetArea(docks[i]), Qt::DockWidgetArea(1 << i%4));
+ }
}
}
@@ -1426,7 +1426,7 @@ public:
QSize sizeHint() const
{
- return QSize(200, 200);
+ return QSize(200, 200);
}
};
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 2b8e735a0e..2e492f3a5c 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -173,22 +173,22 @@ const int RESET = 0;
/*!
Test plan:
insertItem (all flavors and combinations)
- removing menu items
- clearing the menu
-
- check the common behaviour + emitted signals for:
- accelerator keys
- navigating tru the menu and then pressing ENTER
- mouse clicks
- mouse drags
- combinations of key + mouse (if possible)
- checked / unckecked state of menu options
- active / inactive state
+ removing menu items
+ clearing the menu
+
+ check the common behaviour + emitted signals for:
+ accelerator keys
+ navigating tru the menu and then pressing ENTER
+ mouse clicks
+ mouse drags
+ combinations of key + mouse (if possible)
+ checked / unckecked state of menu options
+ active / inactive state
Can't test these without pixmap comparison...
- show and hide
- icons in a menu
- pixmaps in a menu
+ show and hide
+ icons in a menu
+ pixmaps in a menu
*/
@@ -481,17 +481,17 @@ void tst_QMenuBar::removeItemAt()
switch (removeIndex )
{
case 0:
- QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 2") );
- QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") );
- break;
+ QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 2") );
+ QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") );
+ break;
case 1:
- QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") );
- QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") );
- break;
+ QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") );
+ QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 3") );
+ break;
case 2:
- QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") );
- QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 2") );
- break;
+ QCOMPARE( menuBarActions2.at(0)->text(), QString("Menu 1") );
+ QCOMPARE( menuBarActions2.at(1)->text(), QString("Menu 2") );
+ break;
}
QVERIFY( menuBarActions2.size() == 2 );
@@ -827,7 +827,7 @@ void tst_QMenuBar::check_escKey()
// void tst_QMenuBar::check_mouse1()
// {
// if (QSystem::curStyle() == "Motif")
-// QSKIP("This fails in Motif due to a bug in the testing framework");
+// QSKIP("This fails in Motif due to a bug in the testing framework");
// QFETCH( QString, popup_item );
// QFETCH( int, itemA_count );
// QFETCH( int, itemB_count );
@@ -888,7 +888,7 @@ void tst_QMenuBar::check_escKey()
// void tst_QMenuBar::check_mouse2()
// {
// if (QSystem::curStyle() == "Motif")
-// QSKIP("This fails in Motif due to a bug in the testing framework");
+// QSKIP("This fails in Motif due to a bug in the testing framework");
// QFETCH( QString, label );
// QFETCH( int, itemA_count );
// QFETCH( int, itemB_count );
@@ -961,8 +961,8 @@ void tst_QMenuBar::allowActiveAndDisabled()
void tst_QMenuBar::check_altPress()
{
if ( !qApp->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation) ) {
- QSKIP( QString( "this is not supposed to work in the %1 style. Skipping." ).
- arg( qApp->style()->objectName() ).toLatin1());
+ QSKIP(QString( "this is not supposed to work in the %1 style. Skipping." ).
+ arg(qApp->style()->objectName()).toLatin1());
}
QMainWindow w;
@@ -1141,7 +1141,7 @@ void tst_QMenuBar::task223138_triggered()
void tst_QMenuBar::task256322_highlight()
{
QMainWindow win;
- win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars
+ win.menuBar()->setNativeMenuBar(false); //we can't check the geometry of native menubars
QMenu menu;
QAction *file = win.menuBar()->addMenu(&menu);
file->setText("file");
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index d336d00b3e..1eccdd768b 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -490,8 +490,8 @@ void tst_QPushButton::defaultAndAutoDefault()
// Adding buttons to QDialog through a layout
QDialog dialog;
- QPushButton button3;
- button3.setAutoDefault(false);
+ QPushButton button3;
+ button3.setAutoDefault(false);
QPushButton button1;
QVERIFY(!button1.autoDefault());
@@ -512,7 +512,7 @@ void tst_QPushButton::defaultAndAutoDefault()
layout.addWidget(&button2, 0, 2);
layout.addWidget(&button1, 0, 1);
dialog.setLayout(&layout);
- button3.setFocus();
+ button3.setFocus();
QVERIFY(button1.autoDefault());
QVERIFY(button1.isDefault());
QVERIFY(button2.autoDefault());
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index a21f2d70a0..21034e8f1b 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -144,6 +144,10 @@ private slots:
void lineEditReturnPressed();
void positiveSign();
+
+ void setGroupSeparatorShown_data();
+ void setGroupSeparatorShown();
+
public slots:
void valueChangedHelper(const QString &);
void valueChangedHelper(int);
@@ -154,6 +158,9 @@ private:
typedef QList<int> IntList;
+Q_DECLARE_METATYPE(QLocale::Language)
+Q_DECLARE_METATYPE(QLocale::Country)
+
// Testing get/set functions
void tst_QSpinBox::getSetCheck()
{
@@ -1128,5 +1135,47 @@ void tst_QSpinBox::positiveSign()
QCOMPARE(spinBox.text(), QLatin1String("+20"));
}
+void tst_QSpinBox::setGroupSeparatorShown_data()
+{
+ QTest::addColumn<QLocale::Language>("lang");
+ QTest::addColumn<QLocale::Country>("country");
+
+ QTest::newRow("data0") << QLocale::English << QLocale::UnitedStates;
+ QTest::newRow("data1") << QLocale::Swedish << QLocale::Sweden;
+ QTest::newRow("data2") << QLocale::German << QLocale::Germany;
+ QTest::newRow("data3") << QLocale::Georgian << QLocale::Georgia;
+ QTest::newRow("data3") << QLocale::Macedonian << QLocale::Macedonia;
+}
+
+void tst_QSpinBox::setGroupSeparatorShown()
+{
+ QFETCH(QLocale::Language, lang);
+ QFETCH(QLocale::Country, country);
+
+ QLocale loc(lang, country);
+ QLocale::setDefault(loc);
+ SpinBox spinBox;
+ spinBox.setMaximum(99999);
+ spinBox.setValue(13000);
+ spinBox.setGroupSeparatorShown(true);
+ QCOMPARE(spinBox.lineEdit()->text(), spinBox.locale().toString(13000));
+ QCOMPARE(spinBox.isGroupSeparatorShown(), true);
+ QCOMPARE(spinBox.textFromValue(23421),spinBox.locale().toString(23421));
+
+ spinBox.setGroupSeparatorShown(false);
+ QCOMPARE(spinBox.lineEdit()->text(), QStringLiteral("13000"));
+ QCOMPARE(spinBox.isGroupSeparatorShown(), false);
+
+ spinBox.setMaximum(72000);
+ spinBox.lineEdit()->setText(spinBox.locale().toString(32000));
+ QCOMPARE(spinBox.value()+1000, 33000);
+
+ spinBox.lineEdit()->setText(QStringLiteral("32000"));
+ QCOMPARE(spinBox.value()+1000, 33000);
+
+ spinBox.lineEdit()->setText(QStringLiteral("32,000"));
+ QCOMPARE(spinBox.value()+1000, 33000);
+}
+
QTEST_MAIN(tst_QSpinBox)
#include "tst_qspinbox.moc"
diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro
index 72956a6867..c367959cbc 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:!wince*:LIBS += -luser32
+win32:!wince*:!winrt:LIBS += -luser32
diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
index fa518e6afd..e55438f3d3 100644
--- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp
@@ -48,7 +48,7 @@
#include <qlabel.h>
#include <QtWidgets/qboxlayout.h>
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
# include <qt_windows.h>
#define Q_CHECK_PAINTEVENTS \
if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index 11bb5c88a1..d06807eedb 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -203,6 +203,8 @@ private slots:
void highlightLongLine();
+ void countTextChangedOnRemove();
+
private:
void createSelection();
int blockCount() const;
@@ -2499,6 +2501,19 @@ void tst_QTextEdit::highlightLongLine()
QVERIFY(true);
}
+//check for bug 15003, are there multiple textChanged() signals on remove?
+void tst_QTextEdit::countTextChangedOnRemove()
+{
+ QTextEdit edit;
+ edit.insertPlainText("Hello");
+
+ QSignalSpy spy(&edit, SIGNAL(textChanged()));
+
+ QKeyEvent event(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);
+ QCoreApplication::instance()->notify(&edit, &event);
+
+ QCOMPARE(spy.count(), 1);
+}
QTEST_MAIN(tst_QTextEdit)
#include "tst_qtextedit.moc"
diff --git a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp
index a00db02c0a..13d958c8ca 100644
--- a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp
+++ b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp
@@ -252,9 +252,9 @@ void tst_QToolBox::change()
QVERIFY( lastItem );
for ( int c = 0; c < testWidget->count(); ++c ) {
- QString label = "Item " + QString::number(c);
- testWidget->setItemText(c, label);
- QCOMPARE( testWidget->itemText(c), label );
+ QString label = "Item " + QString::number(c);
+ testWidget->setItemText(c, label);
+ QCOMPARE( testWidget->itemText(c), label );
}
testWidget->setCurrentIndex( 0 );