From 1501f1ddd499320c264dc3ab16d4ce8b408991bb Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Wed, 22 Feb 2012 18:29:51 -0800 Subject: QMenuBar: Clean up Q_WS_WIN - Replace Q_WS_WIN with Q_OS_WIN - Remove useless #ifdef Q_OS_WINCE which located in another #ifdef Q_OS_WINCE Change-Id: I6279b6d74902ab3ca6bdb7292c2936a76e3e6952 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'tests/auto/widgets/widgets') 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 #include -#ifdef Q_WS_WIN -#include -#endif - #include QT_FORWARD_DECLARE_CLASS(QMainWindow) -- cgit v1.2.3 From d2f65aa470fe30849a01380e4a50e8a4ebbce07e Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Sun, 25 Dec 2011 00:47:41 +0800 Subject: Fix conflict between QMainWindow::restoreState() and QWidget::setStylesheet() If QMainWindow::restoreState() then QWidget::setStylesheet() were called before the QMainWindow is shown, the size of QDockWidget can not be restored. QWidget::setStylesheet() will generate QEvent::StyleChange event, which will cause the function QDockAreaLayout::fitLayout() to be called before the layout of MainWindow is activated. Although the state info has been stored in a QMainWindowLayoutState variable by QMainWindow::restoreState(), but QMainWindowLayout::setGeometry() still isn't called at present. So QDockAreaLayout::fitLayout() will force the size of dockwidgets and centralwidget to be calculated using the wrong geometry, which will break the state restored by QMainWindow::restoreState(). This is a side effect of 692e9103ebb85b90e79377206d5d03b704d43d42. Task-number: QTBUG-15080 Change-Id: I8cda6a529d178f7467a59b780db80df0a44d4769 Reviewed-by: Olivier Goffart --- .../widgets/qmainwindow/tst_qmainwindow.cpp | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests/auto/widgets/widgets') 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 -- cgit v1.2.3 From 660af10dee503729025952ed2374b8a081f941a2 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 23 Feb 2012 10:13:41 +0100 Subject: Update tst_QTextEdit::fullWidthSelection Since we would add 1 to the height of script lines in the layout before and there was no compensation for this in the box font engine, which is used by this test, the selection rect in the test images was one pixel too high. Now that the +1 has been removed from the height, the images have to be updated. Change-Id: Ic9ea0ace6b61be496846c7f757ae309756cd9f5f Reviewed-by: Bradley T. Hughes --- .../fullWidthSelection/centered-fully-selected.png | Bin 1232 -> 1247 bytes .../fullWidthSelection/centered-partly-selected.png | Bin 1231 -> 1246 bytes .../fullWidthSelection/last-char-on-line.png | Bin 1226 -> 1241 bytes .../fullWidthSelection/last-char-on-parag.png | Bin 1223 -> 1238 bytes .../fullWidthSelection/multiple-full-width-lines.png | Bin 1236 -> 1250 bytes .../qtextedit/fullWidthSelection/nowrap_long.png | Bin 1199 -> 1214 bytes .../fullWidthSelection/single-full-width-line.png | Bin 1225 -> 1240 bytes 7 files changed, 0 insertions(+), 0 deletions(-) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png index ced6eb6e5b..b9df19eeb3 100644 Binary files a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png and b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-fully-selected.png differ diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png index 481b99c7fc..792593ff12 100644 Binary files a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png and b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/centered-partly-selected.png differ 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 index 292d3f9d4c..02e5e93380 100644 Binary files a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png and b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-line.png differ 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 index 69b72ede09..5ef32d2d19 100644 Binary files a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png and b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/last-char-on-parag.png differ 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 index 467b91e6e0..d877e1b656 100644 Binary files a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png and b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/multiple-full-width-lines.png differ diff --git a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png index cce921b0cc..411c0859aa 100644 Binary files a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png and b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/nowrap_long.png differ 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 index 937494ac3c..55d060af1f 100644 Binary files a/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png and b/tests/auto/widgets/widgets/qtextedit/fullWidthSelection/single-full-width-line.png differ -- cgit v1.2.3 From ed7f78acba45e1142157e39154466a13f9d3ce4e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 23 Feb 2012 17:27:47 +0100 Subject: Fix tst_qlineedit. - Fix key handling in QWidgetLineControl according to the keyboard scheme returned by the QPlatformTheme, remove #ifdefs. - Do the same in the test. Task-number: QTBUG-21402 Change-Id: I36d836584e7122309061af72819a4147cadd0a74 Reviewed-by: Miikka Heikkinen Reviewed-by: Bradley T. Hughes --- tests/auto/widgets/widgets/qlineedit/qlineedit.pro | 4 +- .../widgets/widgets/qlineedit/tst_qlineedit.cpp | 82 +++++++++++++--------- 2 files changed, 48 insertions(+), 38 deletions(-) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro index 77b2ae537c..f674ea3f05 100644 --- a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro +++ b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro @@ -1,6 +1,4 @@ CONFIG += testcase TARGET = tst_qlineedit -QT += widgets testlib +QT += gui-private core-private widgets testlib SOURCES += tst_qlineedit.cpp - -CONFIG += insignificant_test # QTBUG-21402 diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 645f47fc72..17632ec458 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 #ifndef QT_NO_CLIPBOARD #include "qclipboard.h" @@ -300,6 +302,7 @@ private: int lastCursorPos; int newCursorPos; QLineEdit *testWidget; + int m_keyboardScheme; }; typedef QList 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 -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 -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; itext(), 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; itext(), 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); @@ -3624,9 +3637,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(); -- cgit v1.2.3 From 472b06d63a591c8caba2b5b3227881a41c589f78 Mon Sep 17 00:00:00 2001 From: Toby Tomkins Date: Mon, 27 Feb 2012 13:26:56 +1000 Subject: Skip unstable qlineedit autotest on Ubuntu 11.10. Task-number: QTBUG-24518 Change-Id: Ia271a820613c1f8a885779eddd20e261716afc6d Reviewed-by: Rohan McGovern Reviewed-by: Friedemann Kleint --- tests/auto/widgets/widgets/qlineedit/qlineedit.pro | 3 +++ tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp | 3 +++ 2 files changed, 6 insertions(+) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro index f674ea3f05..83f93f0ba0 100644 --- a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro +++ b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro @@ -2,3 +2,6 @@ CONFIG += testcase TARGET = tst_qlineedit QT += gui-private core-private widgets testlib SOURCES += tst_qlineedit.cpp + +# 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 17632ec458..81dc940c00 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -3616,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); -- cgit v1.2.3 From 446d63be1b85284d6175b4781859d14668755ae3 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Fri, 24 Feb 2012 13:46:33 -0800 Subject: Fix tst_qmenu. Clear away Q_WS_WIN/Q_WS_X11 from QMenu. Using the hint returned by the QPlatformTheme. Task-number: QTBUG-24325 Change-Id: Iaa4da26c74273d7cfc1fbec6519c52d09e10f7bb Reviewed-by: Friedemann Kleint --- tests/auto/widgets/widgets/qmenu/qmenu.pro | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/auto/widgets/widgets') 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 -- cgit v1.2.3 From 838f828a1d76c1f9fc1fba669d336e91f622fb94 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 27 Feb 2012 17:09:43 +0100 Subject: QComboBox: Use platform theme hint to determine popup geometry. Change-Id: I1f81be1394455715c5dfcd2d426758c4c7cd91fc Reviewed-by: Bradley T. Hughes --- .../widgets/widgets/qcombobox/tst_qcombobox.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'tests/auto/widgets/widgets') diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 907a239912..0fe93995a1 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 +#include +#include #include #include @@ -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 -- cgit v1.2.3