diff options
Diffstat (limited to 'tests/auto/widgets')
29 files changed, 173 insertions, 211 deletions
diff --git a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro index 730932d83d..b4cf05e347 100644 --- a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro +++ b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro @@ -1,10 +1,7 @@ CONFIG += testcase TEMPLATE = app TARGET = tst_qerrormessage -DEPENDPATH += . -INCLUDEPATH += . QT += widgets testlib -# Input SOURCES += tst_qerrormessage.cpp diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 7ab3100cab..4a6f714a7c 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -489,6 +489,9 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog() void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() { +#ifdef Q_OS_MAC + QSKIP("This test currently fails on Mac OS X, see QTBUG-23602"); +#endif QDir current = QDir::currentPath(); current.mkdir("test"); current.cd("test"); @@ -515,9 +518,6 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() QTest::keyClick(list, Qt::Key_Down); QTest::keyClick(list, Qt::Key_Return); QTest::qWait(200); -#ifdef Q_OS_MAC - QEXPECT_FAIL("", "This test currently fails on Mac OS X, see QTBUG-23602", Continue); -#endif QCOMPARE(fd.isVisible(), true); QTest::qWait(200); file.close(); diff --git a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro index f25ed650c3..91848fee24 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro +++ b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro @@ -1,9 +1,6 @@ -CONFIG += testcase TEMPLATE = app TARGET = tst_qmessagebox -QT += widgets testlib -DEPENDPATH += . -INCLUDEPATH += . +QT += gui-private core-private widgets testlib +CONFIG += testcase -# Input SOURCES += tst_qmessagebox.cpp diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 7fc752488d..1d391a1c09 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -48,6 +48,8 @@ #include <QApplication> #include <QPushButton> #include <QDialogButtonBox> +#include <QPlatformTheme> +#include <private/qguiapplication_p.h> #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) #include <QMacStyle> #endif @@ -407,15 +409,12 @@ void tst_QMessageBox::staticSourceCompat() sendKeySoon(); ret = QMessageBox::information(0, "title", "text", QMessageBox::Yes, QMessageBox::No); int expectedButton = int(QMessageBox::Yes); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) - if (qobject_cast<QMacStyle *>(qApp->style())) - expectedButton = int(QMessageBox::No); -#elif !defined(QT_NO_STYLE_CLEANLOOKS) - if (qobject_cast<QCleanlooksStyle *>(qApp->style())) { - QEXPECT_FAIL("", "Special handling of QMessageBox::information buttons for Cleanlooks not implemented yet, QTBUG-24315", Continue); - expectedButton = int(QMessageBox::No); + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { + const int dialogButtonBoxLayout = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); + if (dialogButtonBoxLayout == QDialogButtonBox::MacLayout + || dialogButtonBoxLayout == QDialogButtonBox::GnomeLayout) + expectedButton = int(QMessageBox::No); } -#endif QCOMPARE(ret, expectedButton); QCOMPARE(keyToSend, -1); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 3257e7efea..220c89ec2f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -51,7 +51,7 @@ #include <private/qgraphicssceneindex_p.h> #include <math.h> #include "../../../gui/painting/qpathclipper/pathcompare.h" -#include "../../shared/platforminputcontext.h" +#include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 7ceeaaa0d3..84dea04c45 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -71,7 +71,7 @@ #include <QtWidgets/QDesktopWidget> #include <private/qgraphicsview_p.h> #include "../../../platformquirks.h" -#include "../../shared/platforminputcontext.h" +#include "../../../shared/platforminputcontext.h" #include <private/qinputmethod_p.h> Q_DECLARE_METATYPE(QList<int>) diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 4dd57e1b90..3edc125b5a 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -205,6 +205,7 @@ private slots: void QTBUG12268_hiddenMovedSectionSorting(); void QTBUG14242_hideSectionAutoSize(); void ensureNoIndexAtLength(); + void offsetConsistent(); void initialSortOrderRole(); @@ -2168,6 +2169,33 @@ void tst_QHeaderView::ensureNoIndexAtLength() QVERIFY(hv->visualIndexAt(hv->length()) == -1); } +void tst_QHeaderView::offsetConsistent() +{ + // Ensure that a hidden section 'far away' + // does not affect setOffsetToSectionPosition .. + const int sectionToHide = 513; + QTableView qtv; + QStandardItemModel amodel(1000, 4); + qtv.setModel(&amodel); + QHeaderView *hv = qtv.verticalHeader(); + for (int u = 0; u < 100; u += 2) + hv->resizeSection(u, 0); + hv->setOffsetToSectionPosition(150); + int offset1 = hv->offset(); + hv->hideSection(sectionToHide); + hv->setOffsetToSectionPosition(150); + int offset2 = hv->offset(); + QVERIFY(offset1 == offset2); + // Ensure that hidden indexes (still) is considered. + hv->resizeSection(sectionToHide, hv->sectionSize(200) * 2); + hv->setOffsetToSectionPosition(800); + offset1 = hv->offset(); + hv->showSection(sectionToHide); + hv->setOffsetToSectionPosition(800); + offset2 = hv->offset(); + QVERIFY(offset2 > offset1); +} + void tst_QHeaderView::initialSortOrderRole() { QTableView view; // ### Shadowing member view (of type QHeaderView) diff --git a/tests/auto/widgets/itemviews/qtableview/qtableview.pro b/tests/auto/widgets/itemviews/qtableview/qtableview.pro index 528fa7d014..889caaf3c8 100644 --- a/tests/auto/widgets/itemviews/qtableview/qtableview.pro +++ b/tests/auto/widgets/itemviews/qtableview/qtableview.pro @@ -1,5 +1,5 @@ CONFIG += testcase - +TARGET = tst_qtableview QT += widgets widgets-private testlib QT += core-private gui-private diff --git a/tests/auto/widgets/kernel/qaction/qaction.pro b/tests/auto/widgets/kernel/qaction/qaction.pro index e6f0735394..c57107b1b0 100644 --- a/tests/auto/widgets/kernel/qaction/qaction.pro +++ b/tests/auto/widgets/kernel/qaction/qaction.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qaction -QT += widgets testlib +QT += gui-private core-private widgets testlib SOURCES += tst_qaction.cpp diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 47aad21074..51123af953 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -46,6 +46,8 @@ #include <qevent.h> #include <qaction.h> #include <qmenu.h> +#include <qplatformtheme_qpa.h> +#include <private/qguiapplication_p.h> class tst_QAction : public QObject { @@ -77,6 +79,7 @@ private slots: private: int m_lastEventType; + int m_keyboardScheme; QAction *m_lastAction; QWidget *m_tstWidget; }; @@ -121,8 +124,10 @@ private: tst_QAction *tst; }; -tst_QAction::tst_QAction() +tst_QAction::tst_QAction() : m_keyboardScheme(QPlatformTheme::WindowsKeyboardScheme) { + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); } tst_QAction::~tst_QAction() @@ -237,13 +242,21 @@ void tst_QAction::setStandardKeys() QVERIFY(act.shortcut() == act.shortcuts().first()); QList<QKeySequence> expected; -#if defined(Q_OS_MAC) - expected << QKeySequence("CTRL+C"); -#else - expected << QKeySequence("CTRL+C") << QKeySequence("CTRL+INSERT"); -#endif -// Qt/Embedded on Windows: expected << QKeySequence("CTRL+C") << QKeySequence("F16") << QKeySequence("CTRL+INSERT"); - QVERIFY(act.shortcuts() == expected); + const QKeySequence ctrlC = QKeySequence(QStringLiteral("CTRL+C")); + const QKeySequence ctrlInsert = QKeySequence(QStringLiteral("CTRL+INSERT")); + switch (m_keyboardScheme) { + case QPlatformTheme::MacKeyboardScheme: + expected << ctrlC; + break; + case QPlatformTheme::WindowsKeyboardScheme: + expected << ctrlC << ctrlInsert; + break; + default: // X11 + expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert; + break; + } + + QCOMPARE(act.shortcuts(), expected); } diff --git a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro index 3b229e31cb..97768eac74 100644 --- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -1,15 +1,6 @@ -###################################################################### -# Automatically generated by qmake (2.00a) Mon Jul 11 11:30:34 2005 -###################################################################### +QT += widgets +CONFIG -= app_bundle -TEMPLATE = app -DEPENDPATH += . -INCLUDEPATH += . DESTDIR = ./ -# Input -QT += widgets SOURCES += main.cpp -CONFIG += qt warn_on create_prl link_prl -CONFIG -= app_bundle - diff --git a/tests/auto/widgets/shared/platforminputcontext.h b/tests/auto/widgets/shared/platforminputcontext.h deleted file mode 100644 index 759123a4a6..0000000000 --- a/tests/auto/widgets/shared/platforminputcontext.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qplatforminputcontext_qpa.h> - -class PlatformInputContext : public QPlatformInputContext -{ -public: - PlatformInputContext() : - m_animating(false), - m_visible(false), - m_updateCallCount(0), - m_resetCallCount(0), - m_commitCallCount(0), - m_lastQueries(Qt::ImhNone), - m_action(QInputPanel::Click), - m_cursorPosition(0), - m_lastEventType(QEvent::None) - {} - - virtual QRectF keyboardRect() const { return m_keyboardRect; } - virtual bool isAnimating() const { return m_animating; } - virtual void reset() { m_resetCallCount++; } - virtual void commit() { m_commitCallCount++; } - - virtual void update(Qt::InputMethodQueries queries) - { - m_updateCallCount++; - m_lastQueries = queries; - } - virtual void invokeAction(QInputPanel::Action action, int cursorPosition) - { - m_action = action; - m_cursorPosition = cursorPosition; - } - virtual bool filterEvent(const QEvent *event) - { - m_lastEventType = event->type(); return false; - } - virtual void showInputPanel() - { - m_visible = true; - } - virtual void hideInputPanel() - { - m_visible = false; - } - virtual bool isInputPanelVisible() const - { - return m_visible; - } - - bool m_animating; - bool m_visible; - int m_updateCallCount; - int m_resetCallCount; - int m_commitCallCount; - Qt::InputMethodQueries m_lastQueries; - QInputPanel::Action m_action; - int m_cursorPosition; - int m_lastEventType; - QRectF m_keyboardRect; -}; diff --git a/tests/auto/widgets/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index 5a18a70d9e..842fd11062 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -1,4 +1,5 @@ CONFIG += testcase +TARGET = tst_qstyle TARGET.EPOCHEAPSIZE = 0x200000 0x800000 QT += widgets testlib SOURCES += tst_qstyle.cpp diff --git a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro index cadc6d6ddc..bf12a6b30f 100644 --- a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro +++ b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro @@ -1,12 +1,7 @@ -###################################################################### -# Automatically generated by qmake (2.00a) ti 8. mar 16:20:21 2005 -###################################################################### +TEMPLATE = app +TARGET = tst_qstyleoption CONFIG += testcase -TARGET = tst_qstyleoption -TEMPLATE = app QT += widgets testlib -# Input -SOURCES += tst_qstyleoption.cpp - +SOURCES += tst_qstyleoption.cpp diff --git a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro index f908c3ab7d..dd17183b30 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro @@ -1,10 +1,10 @@ CONFIG += testcase TARGET = tst_qstylesheetstyle -QT += widgets widgets-private testlib -QT += gui-private -# Input +QT += widgets widgets-private gui-private testlib + SOURCES += tst_qstylesheetstyle.cpp RESOURCES += resources.qrc + requires(contains(QT_CONFIG,private_tests)) win32:CONFIG += insignificant_test # QTBUG-24323 diff --git a/tests/auto/widgets/util/qcompleter/qcompleter.pro b/tests/auto/widgets/util/qcompleter/qcompleter.pro index 63b137eb7c..6a817a89ac 100644 --- a/tests/auto/widgets/util/qcompleter/qcompleter.pro +++ b/tests/auto/widgets/util/qcompleter/qcompleter.pro @@ -2,10 +2,7 @@ CONFIG += testcase TEMPLATE = app TARGET = tst_qcompleter QT += widgets testlib -DEPENDPATH += . -INCLUDEPATH += . .. -# Input SOURCES += tst_qcompleter.cpp CONFIG += insignificant_test # QTBUG-21424 diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 7cc043e247..f9eb8b6159 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -43,6 +43,8 @@ #include "qcombobox.h" #include <private/qcombobox_p.h> +#include <private/qguiapplication_p.h> +#include <qplatformtheme_qpa.h> #include <qfontcombobox.h> #include <qdesktopwidget.h> @@ -1915,19 +1917,15 @@ void tst_QComboBox::itemListPosition() QWidget topLevel; QFontComboBox combo(&topLevel); - //the code to get the avaialbe screen space is copied from QComboBox code + //the code to get the available screen space is copied from QComboBox code const int scrNumber = QApplication::desktop()->screenNumber(&combo); - QRect screen; -#ifdef Q_WS_WIN - screen = QApplication::desktop()->screenGeometry(scrNumber); -#elif defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) - screen = QApplication::desktop()->screenGeometry(scrNumber); - else - screen = QApplication::desktop()->availableGeometry(scrNumber); -#else - screen = QApplication::desktop()->availableGeometry(scrNumber); -#endif + + bool useFullScreenForPopupMenu = false; + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool(); + const QRect screen = useFullScreenForPopupMenu ? + QApplication::desktop()->screenGeometry(scrNumber) : + QApplication::desktop()->availableGeometry(scrNumber); combo.move(screen.width()-combo.sizeHint().width(), 0); //puts the combo to the top-right corner diff --git a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro index 77b2ae537c..83f93f0ba0 100644 --- a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro +++ b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro @@ -1,6 +1,7 @@ CONFIG += testcase TARGET = tst_qlineedit -QT += widgets testlib +QT += gui-private core-private widgets testlib SOURCES += tst_qlineedit.cpp -CONFIG += insignificant_test # QTBUG-21402 +# QTBUG-24518 - unstable test +linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 645f47fc72..81dc940c00 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -48,6 +48,8 @@ #include "qvalidator.h" #include "qcompleter.h" #include "qstandarditemmodel.h" +#include "qplatformtheme_qpa.h" +#include <private/qguiapplication_p.h> #ifndef QT_NO_CLIPBOARD #include "qclipboard.h" @@ -300,6 +302,7 @@ private: int lastCursorPos; int newCursorPos; QLineEdit *testWidget; + int m_keyboardScheme; }; typedef QList<int> IntList; @@ -327,9 +330,16 @@ void tst_QLineEdit::getSetCheck() QCOMPARE(true, obj1.dragEnabled()); } -tst_QLineEdit::tst_QLineEdit() +tst_QLineEdit::tst_QLineEdit() : validInput(false), m_keyboardScheme(0) { - validInput = false; + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + m_keyboardScheme = theme->themeHint(QPlatformTheme::KeyboardScheme).toInt(); + // Generalize for X11 + if (m_keyboardScheme == QPlatformTheme::KdeKeyboardScheme + || m_keyboardScheme == QPlatformTheme::GnomeKeyboardScheme + || m_keyboardScheme == QPlatformTheme::CdeKeyboardScheme) { + m_keyboardScheme = QPlatformTheme::X11KeyboardScheme; + } } tst_QLineEdit::~tst_QLineEdit() @@ -1071,25 +1081,26 @@ void tst_QLineEdit::undo() QVERIFY(!testWidget->isUndoAvailable()); QVERIFY(testWidget->text().isEmpty()); -#ifdef Q_WS_WIN - // Repeat the test using shortcut instead of undo() - for (i=0; i<insertString.size(); ++i) { - if (insertIndex[i] > -1) - testWidget->setCursorPosition(insertIndex[i]); - if (insertMode[i] == REPLACE_UNTIL_END) { - testWidget->setSelection(insertIndex[i], 8); + + if (m_keyboardScheme == QPlatformTheme::WindowsKeyboardScheme) { + // Repeat the test using shortcut instead of undo() + for (i=0; i<insertString.size(); ++i) { + if (insertIndex[i] > -1) + testWidget->setCursorPosition(insertIndex[i]); + if (insertMode[i] == REPLACE_UNTIL_END) + testWidget->setSelection(insertIndex[i], 8); + if (use_keys) + QTest::keyClicks(testWidget, insertString[i]); + else + testWidget->insert(insertString[i]); + } + for (i=0; i<expectedString.size()-1; ++i) { + QCOMPARE(testWidget->text(), expectedString[i]); + QVERIFY(testWidget->isUndoAvailable()); + QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier); } - if (use_keys) - QTest::keyClicks(testWidget, insertString[i]); - else - testWidget->insert(insertString[i]); - } - for (i=0; i<expectedString.size()-1; ++i) { - QCOMPARE(testWidget->text(), expectedString[i]); - QVERIFY(testWidget->isUndoAvailable()); - QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier); } -#endif + } void tst_QLineEdit::redo_data() @@ -1152,21 +1163,22 @@ void tst_QLineEdit::redo() QVERIFY(!testWidget->isRedoAvailable()); -#ifdef Q_WS_WIN - // repeat test, this time using shortcuts instead of undo()/redo() - while (!testWidget->text().isEmpty()) - QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier); + if (m_keyboardScheme == QPlatformTheme::WindowsKeyboardScheme) { + // repeat test, this time using shortcuts instead of undo()/redo() - for (i = 0; i < expectedString.size(); ++i) { - QVERIFY(testWidget->isRedoAvailable()); - QTest::keyClick(testWidget, Qt::Key_Backspace, - Qt::ShiftModifier | Qt::AltModifier); - QCOMPARE(testWidget->text() , expectedString[i]); - } + while (!testWidget->text().isEmpty()) + QTest::keyClick(testWidget, Qt::Key_Backspace, Qt::AltModifier); - QVERIFY(!testWidget->isRedoAvailable()); -#endif + for (i = 0; i < expectedString.size(); ++i) { + QVERIFY(testWidget->isRedoAvailable()); + QTest::keyClick(testWidget, Qt::Key_Backspace, + Qt::ShiftModifier | Qt::AltModifier); + QCOMPARE(testWidget->text() , expectedString[i]); + } + + QVERIFY(!testWidget->isRedoAvailable()); + } } void tst_QLineEdit::undo_keypressevents_data() @@ -1263,7 +1275,7 @@ void tst_QLineEdit::undo_keypressevents_data() // unselect any current selection keys.addKeyClick(Qt::Key_Right); -#ifdef Q_WS_WIN //Mac has a specialcase to handle jumping to the end of a selection +#ifdef Q_OS_WIN //Mac has a specialcase to handle jumping to the end of a selection keys.addKeyClick(Qt::Key_Left); #endif @@ -3080,6 +3092,7 @@ void tst_QLineEdit::leftKeyOnSelectedText() #ifdef Q_OS_WIN QCOMPARE(testWidget->cursorPosition(), 1); #else + // Selection is cleared ands cursor remains at position 2. // X11 used to behave like window prior to 4.2. Changes caused by QKeySequence // resulted in an inadvertant change in behavior QCOMPARE(testWidget->cursorPosition(), 2); @@ -3603,6 +3616,9 @@ void tst_QLineEdit::taskQTBUG_7902_contextMenuCrash() void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() { +#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__) + QSKIP("QTBUG-24518 - Unstable test for Ubuntu 11.10"); +#endif //ReadOnly QLineEdit should not intercept shortcut. QLineEdit le; le.setReadOnly(true); @@ -3624,9 +3640,8 @@ void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut() void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() { -#ifndef Q_WS_X11 - QSKIP("Only tested on X11"); -#endif + if (m_keyboardScheme != QPlatformTheme::X11KeyboardScheme) + QSKIP("Only tested on X11"); QLineEdit le; le.setText(" "); QPalette p = le.palette(); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 13540355c7..0f07546559 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -101,6 +101,7 @@ private slots: void centralWidgetSize(); void dockWidgetSize(); void QTBUG2774_stylechange(); + void QTBUG15080_restoreState(); void toggleUnifiedTitleAndToolBarOnMac(); }; @@ -1705,6 +1706,41 @@ void tst_QMainWindow::QTBUG2774_stylechange() } } +void tst_QMainWindow::QTBUG15080_restoreState() +{ + QByteArray state; + + //save state + { + QMainWindow mw1; + QDockWidget * dw1 = new QDockWidget(); + dw1->setObjectName("Left DockWidget"); + mw1.addDockWidget(Qt::LeftDockWidgetArea, dw1); + mw1.setCentralWidget(new QTextEdit()); + mw1.show(); + QApplication::processEvents(); + dw1->setFixedWidth(101); + QApplication::processEvents(); + + state = mw1.saveState(); + } + + //restore state + + QMainWindow mw2; + QDockWidget * dw2 = new QDockWidget(); + dw2->setObjectName("Left DockWidget"); + mw2.addDockWidget(Qt::LeftDockWidgetArea, dw2); + mw2.setCentralWidget(new QTextEdit()); + mw2.restoreState(state); + //QTBUG15080 caused by setStyleSheet + mw2.setStyleSheet("color:red"); + mw2.show(); + QApplication::processEvents(); + + QCOMPARE(dw2->width(), 101); +} + void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac() { #ifdef Q_OS_MAC diff --git a/tests/auto/widgets/widgets/qmenu/qmenu.pro b/tests/auto/widgets/widgets/qmenu/qmenu.pro index 55099f1c54..9efd0302bf 100644 --- a/tests/auto/widgets/widgets/qmenu/qmenu.pro +++ b/tests/auto/widgets/widgets/qmenu/qmenu.pro @@ -3,4 +3,3 @@ TARGET = tst_qmenu QT += widgets testlib SOURCES += tst_qmenu.cpp -win32:CONFIG += insignificant_test # QTBUG-24325 diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 9989e5e7aa..6a1f418739 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -50,10 +50,6 @@ #include <qaction.h> #include <qstyleoption.h> -#ifdef Q_WS_WIN -#include <windows.h> -#endif - #include <qobject.h> QT_FORWARD_DECLARE_CLASS(QMainWindow) diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png Binary files differindex ced6eb6e5b..b9df19eeb3 100644 --- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png +++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png Binary files differindex 481b99c7fc..792593ff12 100644 --- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png +++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png Binary files differindex 292d3f9d4c..02e5e93380 100644 --- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png +++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png Binary files differindex 69b72ede09..5ef32d2d19 100644 --- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png +++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png Binary files differindex 467b91e6e0..d877e1b656 100644 --- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png +++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png Binary files differindex cce921b0cc..411c0859aa 100644 --- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png +++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png Binary files differindex 937494ac3c..55d060af1f 100644 --- a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png +++ b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png |