diff options
Diffstat (limited to 'tests/auto/widgets/widgets')
15 files changed, 203 insertions, 177 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 50024460fc..edaf033678 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -62,6 +62,7 @@ #include <qstyleditemdelegate.h> #include <qstandarditemmodel.h> #include <qproxystyle.h> +#include <qfont.h> static inline void setFrameless(QWidget *w) { @@ -78,9 +79,6 @@ class tst_QComboBox : public QObject public: tst_QComboBox() {} -public slots: - void init(); - private slots: void getSetCheck(); void ensureReturnIsIgnored(); @@ -163,6 +161,7 @@ private slots: void respectChangedOwnershipOfItemView(); void task_QTBUG_39088_inputMethodHints(); void task_QTBUG_49831_scrollerNotActivated(); + void task_QTBUG_56693_itemFontFromModel(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -396,13 +395,6 @@ private: }; -void tst_QComboBox::init() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QComboBox::setEditable() { TestWidget topLevel; @@ -2753,7 +2745,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QCOMPARE(combo.currentText(), QLatin1String("0")); // When calling cursor function, Windows CE responds with: This function is not supported on this system. -#if !defined Q_OS_WINCE && !defined Q_OS_QNX +#if !defined Q_OS_QNX // Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA: centerCursor(combo.view()); QTest::qWait(200); @@ -3260,5 +3252,77 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated() } } +class QTBUG_56693_Model : public QStandardItemModel +{ +public: + QTBUG_56693_Model(QObject *parent = Q_NULLPTR) + : QStandardItemModel(parent) + { } + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override + { + if (role == Qt::FontRole) { + if (index.row() < 5) { + QFont font = QApplication::font(); + font.setItalic(true); + return font; + } else { + return QApplication::font(); + } + } + return QStandardItemModel::data(index, role); + } +}; + +class QTBUG_56693_ProxyStyle : public QProxyStyle +{ +public: + QTBUG_56693_ProxyStyle(QStyle *style) + : QProxyStyle(style), italicItemsNo(0) + { + + } + + void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w = Q_NULLPTR) const override + { + if (element == CE_MenuItem) + if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) + if (menuItem->font.italic()) + italicItemsNo++; + + baseStyle()->drawControl(element, opt, p, w); + } + + mutable int italicItemsNo; +}; + +void tst_QComboBox::task_QTBUG_56693_itemFontFromModel() +{ + QComboBox box; + if (!qobject_cast<QComboMenuDelegate *>(box.itemDelegate())) + QSKIP("Only for combo boxes using QComboMenuDelegate"); + + QTBUG_56693_Model model; + box.setModel(&model); + + QTBUG_56693_ProxyStyle *proxyStyle = new QTBUG_56693_ProxyStyle(box.style()); + box.setStyle(proxyStyle); + box.setFont(QApplication::font()); + + for (int i = 0; i < 10; i++) + box.addItem(QLatin1String("Item ") + QString::number(i)); + + box.show(); + QTest::qWaitForWindowExposed(&box); + box.showPopup(); + QFrame *container = box.findChild<QComboBoxPrivateContainer *>(); + QVERIFY(container); + QTest::qWaitForWindowExposed(container); + + QCOMPARE(proxyStyle->italicItemsNo, 5); + + box.hidePopup(); +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" diff --git a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro index 411185ae2a..c4bc1cab21 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro +++ b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qdatetimeedit QT += widgets testlib core-private widgets-private SOURCES += tst_qdatetimeedit.cpp - -wincewm50smart-msvc2005: DEFINES += WINCE_NO_MODIFIER_KEYS diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 9e09d17903..9ab755c5f1 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -84,30 +84,6 @@ Q_DECLARE_METATYPE(Qt::Key); Q_DECLARE_METATYPE(Qt::KeyboardModifiers); Q_DECLARE_METATYPE(Qt::KeyboardModifier); -#if defined(Q_OS_WINCE) -#ifndef SPI_GETPLATFORMTYPE -#define SPI_GETPLATFORMTYPE 257 -#endif - -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMTYPE, - sizeof(tszPlatform)/sizeof(*tszPlatform),tszPlatform,0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} -#endif - class EditorDateEdit : public QDateTimeEdit { Q_OBJECT @@ -332,7 +308,7 @@ void tst_QDateTimeEdit::cleanupTestCase() void tst_QDateTimeEdit::init() { QLocale::setDefault(QLocale(QLocale::C)); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); #endif testWidget->setDisplayFormat("dd/MM/yyyy"); // Nice default to have @@ -3108,7 +3084,7 @@ void tst_QDateTimeEdit::nextPrevSection_data() // 1. mac doesn't do these, // 2. some WinCE devices do not have modifiers -#if !defined(Q_OS_MAC) && !defined(WINCE_NO_MODIFIER_KEYS) +#if !defined(Q_OS_DARWIN) QTest::newRow("ctrl-right") << Qt::Key_Right << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("56"); QTest::newRow("ctrl-left") << Qt::Key_Left << (Qt::KeyboardModifiers)Qt::ControlModifier << QString("12"); #endif diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 598b518810..a4614d0a9d 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -70,8 +70,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE class QPainter; QT_END_NAMESPACE @@ -252,7 +250,7 @@ private slots: void noTextEditedOnClear(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void cursor(); #endif @@ -3484,7 +3482,7 @@ void tst_QLineEdit::textMargin() QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QLineEdit::cursor() { QLineEdit *testWidget = ensureTestWidget(); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 6ee5f76c6a..680fea27dd 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -45,7 +45,9 @@ #include <private/qmainwindowlayout_p.h> #include <private/qdockarealayout_p.h> -#include "../../../qtest-config.h" +#ifndef QT_NO_TABBAR +#include <qtabbar.h> +#endif static uchar restoreData41[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x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0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3, 0x8a, 0x0, 0x0, 0x2, 0x2b, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8}; @@ -131,7 +133,7 @@ private slots: void contentsMargins_data(); void contentsMargins(); void isSeparator(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setCursor(); #endif void addToolbarAfterShow(); @@ -146,6 +148,9 @@ private slots: void QTBUG21378_animationFinished(); void resizeDocks(); void resizeDocks_data(); +#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR) + void QTBUG52175_tabifiedDockWidgetActivated(); +#endif }; @@ -595,9 +600,6 @@ void tst_QMainWindow::menuBar() mw.setMenuBar(mb1); QVERIFY(mw.menuBar() != 0); QCOMPARE(mw.menuBar(), (QMenuBar *)mb1); -#ifdef Q_OS_WINCE_WM - QSKIP("With native menubar integration the menubar is not a child"); -#endif QCOMPARE(mb1->parentWidget(), (QWidget *)&mw); mw.setMenuBar(0); @@ -1732,7 +1734,7 @@ class MainWindow : public QMainWindow { using QMainWindow::event; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QMainWindow::setCursor() { MainWindow mw; @@ -2042,5 +2044,52 @@ void tst_QMainWindow::resizeDocks() } } +#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_TABBAR) +void tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated() +{ + QMainWindow w; + + QDockWidget *dwFirst = new QDockWidget(&w); + dwFirst->setWidget(new QWidget(dwFirst)); + w.addDockWidget(Qt::LeftDockWidgetArea, dwFirst); + + QDockWidget *dwSecond = new QDockWidget(&w); + dwSecond->setWidget(new QWidget(dwSecond)); + w.addDockWidget(Qt::LeftDockWidgetArea, dwSecond); + + w.tabifyDockWidget(dwFirst, dwSecond); + w.show(); + QVERIFY(QTest::qWaitForWindowActive(&w)); + + QTabBar *tabBar = w.findChild<QTabBar *>(); + QVERIFY(tabBar); + + QDockWidget *activated = nullptr; + connect(&w, &QMainWindow::tabifiedDockWidgetActivated, [&activated](QDockWidget *dockWidget) + { + activated = dockWidget; + }); + + w.hide(); + QCoreApplication::processEvents(); + QCOMPARE(activated, nullptr); + + w.show(); + QCoreApplication::processEvents(); + QCOMPARE(activated, nullptr); + + tabBar->setCurrentIndex(1); + QCoreApplication::processEvents(); + QCOMPARE(activated, nullptr); + + tabBar->setCurrentIndex(0); + QTRY_COMPARE(activated, dwFirst); + activated = nullptr; + + tabBar->setCurrentIndex(1); + QTRY_COMPARE(activated, dwSecond); +} +#endif + QTEST_MAIN(tst_QMainWindow) #include "tst_qmainwindow.moc" diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 809fa56a61..52d7a39406 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -228,7 +228,6 @@ class tst_QMdiArea : public QObject public: tst_QMdiArea(); public slots: - void initTestCase(); void cleanup(); protected slots: @@ -293,13 +292,6 @@ tst_QMdiArea::tst_QMdiArea() qRegisterMetaType<QMdiSubWindow *>(); } -void tst_QMdiArea::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QMdiArea::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); @@ -482,7 +474,7 @@ void tst_QMdiArea::subWindowActivated2() // Check that we only emit _one_ signal and the active window // is unchanged after hide/show. mdiArea.hide(); -#ifdef Q_DEAD_CODE_FROM_QT4_X11 +#if 0 // Used to be included in Qt4 for Q_WS_X11 qt_x11_wait_for_window_manager(&mdiArea); #endif QTest::qWait(100); @@ -509,9 +501,6 @@ void tst_QMdiArea::subWindowActivated2() if (!macHasAccessToWindowsServer()) QEXPECT_FAIL("", "showMinimized doesn't really minimize if you don't have access to the server", Abort); #endif -#ifdef Q_OS_WINCE - QSKIP("Not fixed yet. See Task 197453"); -#endif #ifdef Q_OS_MAC QSKIP("QTBUG-25298: This test is unstable on Mac."); #endif @@ -649,7 +638,7 @@ void tst_QMdiArea::changeWindowTitle() #else widget->setWindowState(Qt::WindowMaximized); #endif -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif @@ -658,7 +647,7 @@ void tst_QMdiArea::changeWindowTitle() mw->show(); QVERIFY(QTest::qWaitForWindowExposed(mw)); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif @@ -676,7 +665,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); widget->setWindowTitle( wc2 ); QCOMPARE( mw->windowTitle(), windowTitle(mwc, wc2) ); @@ -694,7 +683,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif #ifdef USE_SHOW @@ -703,7 +692,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowNoState); #endif qApp->processEvents(); -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) +#if defined(Q_OS_DARWIN) QCOMPARE(mw->windowTitle(), mwc); #else QCOMPARE( mw->windowTitle(), mwc2 ); @@ -715,7 +704,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif qApp->processEvents(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif @@ -764,7 +753,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( mw->isWindowModified(), false); QCOMPARE( widget->isWindowModified(), true); widget->setWindowState(Qt::WindowMaximized); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -774,7 +763,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( widget->isWindowModified(), true); widget->setWindowState(Qt::WindowMaximized); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -784,7 +773,7 @@ void tst_QMdiArea::changeModified() QCOMPARE( widget->isWindowModified(), false); widget->setWindowModified(true); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QCOMPARE( mw->isWindowModified(), true); #endif QCOMPARE( widget->isWindowModified(), true); @@ -1598,9 +1587,7 @@ void tst_QMdiArea::tileSubWindows() qApp->processEvents(); } workspace.setActiveSubWindow(0); -#ifndef Q_OS_WINCE //See Task 197453 ToDo QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect()); -#endif QMdiSubWindow *window = windows.at(0); @@ -1724,9 +1711,6 @@ void tst_QMdiArea::tileSubWindows() frameWidth = workspace.style()->pixelMetric(QStyle::PM_DefaultFrameWidth); const int spacing = 2 * frameWidth + 2; const QSize expectedViewportSize(3 * minSize.width() + spacing, 3 * minSize.height() + spacing); -#ifdef Q_OS_WINCE - QSKIP("Not fixed yet! See task 197453"); -#endif QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize); // Restore original scrollbar behavior for test below @@ -2005,7 +1989,7 @@ void tst_QMdiArea::delayedPlacement() void tst_QMdiArea::iconGeometryInMenuBar() { -#if !defined (Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QMainWindow mainWindow; QMenuBar *menuBar = mainWindow.menuBar(); menuBar->setNativeMenuBar(false); @@ -2063,11 +2047,7 @@ void tst_QMdiArea::resizeTimer() mdiArea.show(); QVERIFY(QTest::qWaitForWindowActive(&mdiArea)); -#ifndef Q_OS_WINCE int time = 250; -#else - int time = 1000; -#endif EventSpy timerEventSpy(subWindow, QEvent::Timer); QCOMPARE(timerEventSpy.count(), 0); diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 3fbb9a3f3f..a9d8c48d63 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -48,10 +48,8 @@ #include <QScreen> #include <QSizeGrip> -#include "../../../qtest-config.h" - QT_BEGIN_NAMESPACE -#if !defined(Q_DEAD_CODE_FROM_QT4_WIN) +#if 1 // Used to be excluded in Qt4 for Q_WS_WIN extern bool qt_tab_all_widgets(); #endif QT_END_NAMESPACE @@ -161,7 +159,7 @@ private slots: void showShaded(); void showNormal_data(); void showNormal(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void setOpaqueResizeAndMove_data(); void setOpaqueResizeAndMove(); #endif @@ -184,7 +182,7 @@ private slots: void explicitlyHiddenWidget(); void resizeTimer(); void fixedMinMaxSize(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) void replaceMenuBarWhileMaximized(); void closeOnDoubleClick_data(); void closeOnDoubleClick(); @@ -575,10 +573,6 @@ void tst_QMdiSubWindow::showShaded() window->showNormal(); QTest::qWait(250); -#ifdef Q_OS_WINCE - QSKIP("Until we have a QEvent::WindowFlagsChange event, this will skip"); -#endif - const QSize minimumSizeHint = window->minimumSizeHint(); QVERIFY(minimumSizeHint.height() < 300); const int maxHeightDiff = 300 - minimumSizeHint.height(); @@ -669,7 +663,7 @@ private: int _count; }; -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QMdiSubWindow::setOpaqueResizeAndMove_data() { QTest::addColumn<bool>("opaqueMode"); @@ -1010,7 +1004,7 @@ void tst_QMdiSubWindow::setSystemMenu() systemMenu->hide(); QVERIFY(!qApp->activePopupWidget()); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) // System menu in menu bar. subWindow->showMaximized(); QVERIFY(subWindow->isMaximized()); @@ -1043,7 +1037,7 @@ void tst_QMdiSubWindow::setSystemMenu() systemMenu->hide(); QVERIFY(!qApp->activePopupWidget()); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) // System menu in menu bar in reverse mode. subWindow->showMaximized(); QVERIFY(subWindow->isMaximized()); @@ -1474,7 +1468,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner)); QMdiSubWindow *subWindow = mdiArea->addSubWindow(new QTextEdit); subWindow->showMaximized(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); #endif @@ -1489,7 +1483,7 @@ void tst_QMdiSubWindow::hideAndShow() // Show QMdiArea. tabWidget->setCurrentIndex(0); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); @@ -1511,7 +1505,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(subWindow); QCOMPARE(mdiArea->activeSubWindow(), subWindow); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(menuBar->cornerWidget(Qt::TopRightCorner)); #if defined Q_OS_QNX QEXPECT_FAIL("", "QTBUG-38231", Abort); @@ -1539,7 +1533,7 @@ void tst_QMdiSubWindow::hideAndShow() QVERIFY(!menuBar->cornerWidget(Qt::TopRightCorner)); subWindow->show(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); @@ -1553,7 +1547,7 @@ void tst_QMdiSubWindow::hideAndShow() // Show QMainWindow. mainWindow.show(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) +#if !defined (Q_OS_DARWIN) QVERIFY(subWindow->maximizedButtonsWidget()); QVERIFY(subWindow->maximizedSystemMenuIconWidget()); QCOMPARE(menuBar->cornerWidget(Qt::TopRightCorner), subWindow->maximizedButtonsWidget()); @@ -1723,7 +1717,7 @@ void tst_QMdiSubWindow::fixedMinMaxSize() QCOMPARE(subWindow->size(), minimumSize); } -#if !defined( Q_OS_MAC) && !defined( Q_OS_WINCE) +#if !defined( Q_OS_DARWIN) void tst_QMdiSubWindow::replaceMenuBarWhileMaximized() { diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 741d6839db..cb7643d1ac 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -81,9 +81,7 @@ private slots: void overrideMenuAction(); void statusTip(); void widgetActionFocus(); -#ifndef Q_OS_WINCE void mouseActivation(); -#endif void tearOff(); void submenuTearOffDontClose(); void layoutDirection(); @@ -96,9 +94,7 @@ private slots: void task250673_activeMultiColumnSubMenuPosition(); void task256918_setFont(); void menuSizeHint(); -#ifndef Q_OS_WINCE void task258920_mouseBorder(); -#endif void setFixedWidth(); void deleteActionInTriggered(); void pushButtonPopulateOnAboutToShow(); @@ -293,8 +289,6 @@ void tst_QMenu::addActionsConnect() #endif // !QT_NO_SHORTCUT } -// We have a separate mouseActivation test for Windows mobile -#ifndef Q_OS_WINCE void tst_QMenu::mouseActivation() { QWidget topLevel; @@ -334,7 +328,6 @@ void tst_QMenu::mouseActivation() QVERIFY(submenu.isVisible()); #endif } -#endif void tst_QMenu::keyboardNavigation_data() { @@ -465,7 +458,7 @@ void tst_QMenu::overrideMenuAction() // On Mac and Windows CE, we need to create native key events to test menu // action activation, so skip this part of the test. -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) QAction *aQuit = new QAction("Quit", &w); aQuit->setShortcut(QKeySequence("Ctrl+X")); m->addAction(aQuit); @@ -762,10 +755,8 @@ void tst_QMenu::activeSubMenuPosition() QVERIFY(sub->pos() != QPoint(0,0)); // well, it's enough to check the pos is not (0,0) but it's more safe // to check that submenu is to the right of the main menu too. -#ifndef Q_OS_WINCE_WM QVERIFY(sub->pos().x() > main->pos().x()); QCOMPARE(sub->activeAction(), subAction); -#endif } // QTBUG-49588, QTBUG-48396: activeSubMenuPositionExec() is the same as @@ -817,10 +808,8 @@ private: void tst_QMenu::activeSubMenuPositionExec() { -#ifndef Q_OS_WINCE SubMenuPositionExecMenu menu; menu.exec(QGuiApplication::primaryScreen()->availableGeometry().center()); -#endif // !Q_OS_WINCE } void tst_QMenu::task242454_sizeHint() @@ -954,7 +943,6 @@ public: }; // Mouse move related signals for Windows Mobile unavailable -#ifndef Q_OS_WINCE void tst_QMenu::task258920_mouseBorder() { Menu258920 menu; @@ -983,7 +971,6 @@ void tst_QMenu::task258920_mouseBorder() QTRY_COMPARE(static_cast<QAction*>(0), menu.activeAction()); QTRY_VERIFY(menu.painted); } -#endif void tst_QMenu::setFixedWidth() { diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 9a68655fb6..3a4c4545df 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -90,7 +90,7 @@ private slots: void count(); void insertItem_QString_QObject(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void accel(); void activatedCount(); @@ -115,7 +115,7 @@ private slots: void check_altPress(); void check_altClosePress(); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void check_shortcutPress(); void check_menuPosition(); #endif @@ -134,6 +134,8 @@ private slots: void taskQTBUG56275_reinsertMenuInParentlessQMenuBar(); #endif + void platformMenu(); + protected slots: void onSimpleActivated( QAction*); void onComplexActionTriggered(); @@ -314,7 +316,7 @@ inline TestMenu tst_QMenuBar::initWindowWithComplexMenuBar(QMainWindow &w) } // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::accel() { // create a popup menu with menu items set the accelerators later... @@ -332,7 +334,7 @@ void tst_QMenuBar::accel() #endif // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::activatedCount() { // create a popup menu with menu items set the accelerators later... @@ -523,7 +525,7 @@ void tst_QMenuBar::insertItem_QString_QObject() } // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_accelKeys() { QMainWindow w; @@ -596,7 +598,7 @@ void tst_QMenuBar::check_accelKeys() #endif // On Mac/WinCE, native key events are needed to test menu action activation -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys1() { QMainWindow w; @@ -630,7 +632,7 @@ void tst_QMenuBar::check_cursorKeys1() #endif // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys2() { QMainWindow w; @@ -663,7 +665,7 @@ void tst_QMenuBar::check_cursorKeys2() If a popupmenu is active you can use Left to move to the menu to the left of it. */ // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_cursorKeys3() { QMainWindow w; @@ -778,7 +780,7 @@ void tst_QMenuBar::check_endKey() */ // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_escKey() { QMainWindow w; @@ -923,7 +925,6 @@ void tst_QMenuBar::check_escKey() // QCOMPARE(m_complexActionTriggerCount['h'], (uint)itemH_count); // } -#ifndef Q_OS_WINCE void tst_QMenuBar::allowActiveAndDisabled() { QMenuBar menuBar; @@ -963,7 +964,6 @@ void tst_QMenuBar::allowActiveAndDisabled() else QCOMPARE(menuBar.activeAction()->text(), fileMenu.title()); } -#endif void tst_QMenuBar::check_altPress() { @@ -1014,7 +1014,7 @@ void tst_QMenuBar::check_altClosePress() } // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_shortcutPress() { QMainWindow w; @@ -1057,7 +1057,7 @@ private: }; // Qt/Mac,WinCE does not use the native popups/menubar -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#if !defined(Q_OS_DARWIN) void tst_QMenuBar::check_menuPosition() { QMainWindow w; @@ -1126,7 +1126,7 @@ void tst_QMenuBar::check_menuPosition() menu.close(); } -# ifndef QTEST_NO_CURSOR +# ifndef QT_NO_CURSOR // QTBUG-28031: Click at bottom-right corner. { w.move(400, 200); @@ -1140,7 +1140,7 @@ void tst_QMenuBar::check_menuPosition() QCOMPARE(menu.geometry().right() - 1, globalPos.x()); menu.close(); } -# endif // QTEST_NO_CURSOR +# endif // QT_NO_CURSOR } #endif @@ -1213,7 +1213,7 @@ void tst_QMenuBar::task256322_highlight() QTRY_VERIFY(!menu2.isVisible()); QVERIFY(!menu.isVisible()); #ifdef Q_OS_MAC - if ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) && (win.menuBar()->activeAction() != nothing)) + if (win.menuBar()->activeAction() != nothing) QEXPECT_FAIL("", "QTBUG-30565: Unstable test", Continue); #endif QTRY_COMPARE(win.menuBar()->activeAction(), nothing); @@ -1396,7 +1396,7 @@ void tst_QMenuBar::cornerWidgets() QFETCH(Qt::Corner, corner); -#if defined(Q_OS_OSX) || defined(Q_OS_WINCE) +#if defined(Q_OS_OSX) QSKIP("Test interferes with native menu bars on this platform"); #endif @@ -1492,6 +1492,25 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested() testMenus.actions[0]->trigger(); } +// QTBUG-56526 +void tst_QMenuBar::platformMenu() +{ + QMenuBar menuBar; + QPlatformMenuBar *platformMenuBar = menuBar.platformMenuBar(); + if (!platformMenuBar) + QSKIP("No platform menubar implementation available on this platform."); + + // QMenu must not create a platform menu instance at creation time, because + // on Unity the type of the platform menu instance must be different (QGtk3Menu + // vs. QDbusPlatformMenu) depending on whether the menu is in the global menubar + // or a standalone context menu. + QMenu *menu = new QMenu(&menuBar); + QVERIFY(!menu->platformMenu()); + + menuBar.addMenu(menu); + QVERIFY(menu->platformMenu()); +} + void tst_QMenuBar::slotForTaskQTBUG53205() { QWidget *parent = taskQTBUG53205MenuBar->parentWidget(); diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index b58d236a91..31bbcf9c7f 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -48,8 +48,6 @@ #include "qplaintextedit.h" #include "../../../shared/platformclipboard.h" -#include "../../../qtest-config.h" - //Used in copyAvailable typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType; typedef QList<keyPairType> pairListType; @@ -64,7 +62,6 @@ public: tst_QPlainTextEdit(); public slots: - void initTestCase(); void init(); void cleanup(); private slots: @@ -104,7 +101,7 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void mouseCursorShape(); #endif void implicitClear(); @@ -208,16 +205,8 @@ void tst_QPlainTextEdit::getSetCheck() QCOMPARE(0, obj1.tabStopWidth()); obj1.setTabStopWidth(INT_MIN); QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value -#if defined(Q_OS_WINCE) - // due to rounding error in qRound when qreal==float - // we cannot use INT_MAX for this check - obj1.setTabStopWidth(SHRT_MAX*2); - QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth()); -#else obj1.setTabStopWidth(INT_MAX); QCOMPARE(INT_MAX, obj1.tabStopWidth()); -#endif - } class QtTestDocumentLayout : public QAbstractTextDocumentLayout @@ -251,13 +240,6 @@ public: tst_QPlainTextEdit::tst_QPlainTextEdit() {} -void tst_QPlainTextEdit::initTestCase() -{ -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif -} - void tst_QPlainTextEdit::init() { ed = new QPlainTextEdit(0); @@ -896,7 +878,7 @@ void tst_QPlainTextEdit::lineWrapModes() delete window; } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QPlainTextEdit::mouseCursorShape() { // always show an IBeamCursor, see change 170146 diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 302d290c72..7bbbc46b5a 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -526,12 +526,6 @@ void tst_QPushButton::sizeHint_data() #if defined(Q_OS_WIN) && !defined(QT_NO_STYLE_WINDOWSVISTA) QTest::newRow("windowsvista") << QString::fromLatin1("windowsvista"); #endif -#if defined(Q_OS_WINCE) && !defined(QT_NO_STYLE_WINDOWSCE) - QTest::newRow("windowsce") << QString::fromLatin1("windowsce"); -#endif -#if defined(Q_OS_WINCE_WM) && !defined(QT_NO_STYLE_WINDOWSCE) - QTest::newRow("windowsmobile") << QString::fromLatin1("windowsmobile"); -#endif } void tst_QPushButton::sizeHint() diff --git a/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro b/tests/auto/widgets/widgets/qtabwidget/qtabwidget.pro index 92c2f6cb7e..6523209c32 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:!winrt: LIBS += -luser32 +win32:!winrt: LIBS += -luser32 diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index f8125bf749..2a2331c3bf 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -35,7 +35,7 @@ #include <qlabel.h> #include <QtWidgets/qboxlayout.h> -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) # include <qt_windows.h> #define Q_CHECK_PAINTEVENTS \ if (::SwitchDesktop(::GetThreadDesktop(::GetCurrentThreadId())) == 0) \ @@ -553,9 +553,7 @@ void tst_QTabWidget::paintEventCount() // Mac, Windows and Windows CE get multiple repaints on the first show, so use those as a starting point. static const int MaxInitialPaintCount = -#if defined(Q_OS_WINCE) - 4; -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) 2; #elif defined(Q_OS_MAC) 5; diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 69f0ff0f7e..cecec48113 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -55,8 +55,6 @@ #include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> -#include "../../../qtest-config.h" - //Used in copyAvailable typedef QPair<Qt::Key, Qt::KeyboardModifier> keyPairType; typedef QList<keyPairType> pairListType; @@ -125,7 +123,7 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void mouseCursorShape(); #endif void implicitClear(); @@ -276,15 +274,8 @@ void tst_QTextEdit::getSetCheck() QCOMPARE(0, obj1.tabStopWidth()); obj1.setTabStopWidth(INT_MIN); QCOMPARE(0, obj1.tabStopWidth()); // Makes no sense to set a negative tabstop value -#if defined(Q_OS_WINCE) - // due to rounding error in qRound when qreal==float - // we cannot use INT_MAX for this check - obj1.setTabStopWidth(SHRT_MAX*2); - QCOMPARE(SHRT_MAX*2, obj1.tabStopWidth()); -#else obj1.setTabStopWidth(INT_MAX); QCOMPARE(INT_MAX, obj1.tabStopWidth()); -#endif // bool QTextEdit::acceptRichText() // void QTextEdit::setAcceptRichText(bool) @@ -378,10 +369,6 @@ void tst_QTextEdit::cleanupTestCase() void tst_QTextEdit::init() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif - ed = new QTextEdit(0); rootFrameMargin = ed->document()->documentMargin(); } @@ -1230,7 +1217,7 @@ void tst_QTextEdit::lineWrapModes() QCOMPARE(ed->document()->pageSize().width(), qreal(1000)); } -#ifndef QTEST_NO_CURSOR +#ifndef QT_NO_CURSOR void tst_QTextEdit::mouseCursorShape() { // always show an IBeamCursor, see change 170146 diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro index 0651583867..a8e8f6d865 100644 --- a/tests/auto/widgets/widgets/widgets.pro +++ b/tests/auto/widgets/widgets/widgets.pro @@ -48,10 +48,10 @@ SUBDIRS=\ qtoolbutton \ # The following tests depend on private API: -!contains(QT_CONFIG, private_tests): SUBDIRS -= \ +!qtConfig(private_tests): SUBDIRS -= \ qcombobox \ qmainwindow \ qtextedit \ qtoolbar \ -contains(QT_CONFIG, opengl): SUBDIRS += qopenglwidget +qtConfig(opengl): SUBDIRS += qopenglwidget |