summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-13 09:50:43 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-03-13 15:55:44 +0100
commitd51c3ecf8ef6e28557c66745f50a223cc5b1ce54 (patch)
tree023a1ecaa944152e08ba11291ec7aadc12f59dad /tests/auto/widgets
parentf06f1adb6cc3835793a15eafa2d5a3affad712a2 (diff)
parent3a1f4b186d8ce79717da37f808ff9a4b3e949d9c (diff)
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts: examples/network/network.pro mkspecs/features/mac/default_post.prf src/corelib/io/qfilesystemengine_win.cpp src/corelib/io/qprocess.cpp src/corelib/io/qprocess.h src/corelib/io/qprocess_p.h src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/corelib/thread/qmutex.cpp src/platformsupport/fontdatabases/windows/windows.pri src/plugins/platforms/eglfs/eglfsdeviceintegration.pro tests/auto/corelib/io/io.pro Change-Id: I8a27e0e141454818bba9c433200a4e84a88d147e
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp16
-rw-r--r--tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp2
-rw-r--r--tests/auto/widgets/util/qundostack/tst_qundostack.cpp2
-rw-r--r--tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp19
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp62
5 files changed, 92 insertions, 9 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index d6f3728663..49095b9625 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -35,7 +35,9 @@
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>
-#include <QtCore/QProcess>
+#if QT_CONFIG(process)
+# include <QtCore/QProcess>
+#endif
#include <QtCore/private/qeventloop_p.h>
#include <QtGui/QFontDatabase>
@@ -119,7 +121,7 @@ private slots:
void testDeleteLater();
void testDeleteLaterProcessEvents();
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
void libraryPaths();
void libraryPaths_qt_plugin_path();
void libraryPaths_qt_plugin_path_2();
@@ -883,7 +885,7 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r)
return j == r.count();
}
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
#define QT_TST_QAPP_DEBUG
void tst_QApplication::libraryPaths()
{
@@ -1432,7 +1434,7 @@ void tst_QApplication::testDeleteLaterProcessEvents()
*/
void tst_QApplication::desktopSettingsAware()
{
-#ifndef QT_NO_PROCESS
+#if QT_CONFIG(process)
QString path;
{
// We need an application object for QFINDTESTDATA to work
@@ -2121,7 +2123,7 @@ void tst_QApplication::qtbug_12673()
QVERIFY2(!path.isEmpty(), "Cannot locate modal helper application");
path += "modal";
-#ifndef QT_NO_PROCESS
+#if QT_CONFIG(process)
QProcess testProcess;
QStringList arguments;
testProcess.start(path, arguments);
@@ -2254,7 +2256,7 @@ void tst_QApplication::settableStyleHints()
executed *after* the destruction of QApplication.
*/
Q_GLOBAL_STATIC(QLocale, tst_qapp_locale);
-#ifndef QT_NO_PROCESS
+#if QT_CONFIG(process)
Q_GLOBAL_STATIC(QProcess, tst_qapp_process);
#endif
#ifndef QT_NO_FILESYSTEMWATCHER
@@ -2279,7 +2281,7 @@ void tst_QApplication::globalStaticObjectDestruction()
int argc = 1;
QApplication app(argc, &argv0);
QVERIFY(tst_qapp_locale());
-#ifndef QT_NO_PROCESS
+#if QT_CONFIG(process)
QVERIFY(tst_qapp_process());
#endif
#ifndef QT_NO_FILESYSTEMWATCHER
diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
index 7641ea6b68..62c3469447 100644
--- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
@@ -606,7 +606,7 @@ void tst_QUndoGroup::addStackAndDie()
void tst_QUndoGroup::commandTextFormat()
{
-#ifdef QT_NO_PROCESS
+#if !QT_CONFIG(process)
QSKIP("No QProcess available");
#else
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
index 11a29b808c..f3185086b8 100644
--- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
+++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp
@@ -3853,7 +3853,7 @@ void tst_QUndoStack::undoLimit()
void tst_QUndoStack::commandTextFormat()
{
-#ifdef QT_NO_PROCESS
+#if !QT_CONFIG(process)
QSKIP("No QProcess available");
#else
QString binDir = QLibraryInfo::location(QLibraryInfo::BinariesPath);
diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index a35ea8eb6e..f127fd98f7 100644
--- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -97,6 +97,8 @@ private slots:
void testDefaultButton();
void task191642_default();
+ void testDeletedStandardButton();
+
private:
qint64 timeStamp;
qint64 buttonClicked1TimeStamp;
@@ -843,5 +845,22 @@ void tst_QDialogButtonBox::task191642_default()
QCOMPARE(clicked.count(), 1);
}
+void tst_QDialogButtonBox::testDeletedStandardButton()
+{
+ QDialogButtonBox buttonBox;
+ delete buttonBox.addButton(QDialogButtonBox::Ok);
+ QPointer<QPushButton> buttonC = buttonBox.addButton(QDialogButtonBox::Cancel);
+ delete buttonBox.addButton(QDialogButtonBox::Cancel);
+ QPointer<QPushButton> buttonA = buttonBox.addButton(QDialogButtonBox::Apply);
+ delete buttonBox.addButton(QDialogButtonBox::Help);
+ // A few button have been deleted, they should automatically be removed
+ QCOMPARE(buttonBox.standardButtons(), QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
+
+ buttonBox.setStandardButtons(QDialogButtonBox::Reset | QDialogButtonBox::Cancel);
+ // setStanderdButton should delete previous buttons
+ QVERIFY(!buttonA);
+ QVERIFY(!buttonC);
+}
+
QTEST_MAIN(tst_QDialogButtonBox)
#include "tst_qdialogbuttonbox.moc"
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 3218b8ac68..b037cc2141 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -42,6 +42,7 @@
#include <qmenu.h>
#include <qstyle.h>
+#include <QStyleHints>
#include <QTimer>
#include <qdebug.h>
@@ -110,6 +111,9 @@ private slots:
void QTBUG_37933_ampersands_data();
void QTBUG_37933_ampersands();
#endif
+ void QTBUG_56917_wideMenuSize();
+ void QTBUG_56917_wideMenuScreenNumber();
+ void QTBUG_56917_wideSubmenuScreenNumber();
protected slots:
void onActivated(QAction*);
void onHighlighted(QAction*);
@@ -1311,5 +1315,63 @@ void tst_QMenu::QTBUG_37933_ampersands()
}
#endif
+void tst_QMenu::QTBUG_56917_wideMenuSize()
+{
+ // menu shouldn't to take on full screen height when menu width is larger than screen width
+ QMenu menu;
+ QString longString;
+ longString.fill(QLatin1Char('Q'), 3000);
+ menu.addAction(longString);
+ QSize menuSizeHint = menu.sizeHint();
+ menu.popup(QPoint());
+ QTest::qWait(100);
+ QVERIFY(QTest::qWaitForWindowExposed(&menu));
+ QVERIFY(menu.isVisible());
+ QVERIFY(menu.height() <= menuSizeHint.height());
+}
+
+void tst_QMenu::QTBUG_56917_wideMenuScreenNumber()
+{
+ if (QApplication::styleHints()->showIsFullScreen())
+ QSKIP("The platform defaults to windows being fullscreen.");
+ // menu must appear on the same screen where show action is triggered
+ QString longString;
+ longString.fill(QLatin1Char('Q'), 3000);
+
+ for (int i = 0; i < QApplication::desktop()->screenCount(); i++) {
+ QMenu menu;
+ menu.addAction(longString);
+ menu.popup(QApplication::desktop()->screen(i)->geometry().center());
+ QTest::qWait(100);
+ QVERIFY(QTest::qWaitForWindowExposed(&menu));
+ QVERIFY(menu.isVisible());
+ QCOMPARE(QApplication::desktop()->screenNumber(&menu), i);
+ }
+}
+
+void tst_QMenu::QTBUG_56917_wideSubmenuScreenNumber()
+{
+ if (QApplication::styleHints()->showIsFullScreen())
+ QSKIP("The platform defaults to windows being fullscreen.");
+ // submenu must appear on the same screen where its parent menu is shown
+ QString longString;
+ longString.fill(QLatin1Char('Q'), 3000);
+
+ for (int i = 0; i < QApplication::desktop()->screenCount(); i++) {
+ QMenu menu;
+ QMenu submenu("Submenu");
+ submenu.addAction(longString);
+ QAction *action = menu.addMenu(&submenu);
+ menu.popup(QApplication::desktop()->screen(i)->geometry().center());
+ QVERIFY(QTest::qWaitForWindowExposed(&menu));
+ QVERIFY(menu.isVisible());
+ QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.actionGeometry(action).center());
+ QTest::qWait(100);
+ QVERIFY(QTest::qWaitForWindowExposed(&submenu));
+ QVERIFY(submenu.isVisible());
+ QCOMPARE(QApplication::desktop()->screenNumber(&submenu), i);
+ }
+}
+
QTEST_MAIN(tst_QMenu)
#include "tst_qmenu.moc"