summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2012-12-28 17:35:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-08 13:54:04 +0100
commit54fd35b134af8d2a17c9c4ece531ddd2ee7258e2 (patch)
tree07353890fc345ff69920df14bb3a31a2bfe30b7e /tests/auto/widgets/kernel
parent41acb58f23c78133657d3fb7d126b6df67e8846f (diff)
Fix warnings about not being able to set Window geometry on Windows.
Fully decorated windows cannot be smaller than 160x30 (Large fonts). Enlarge Windows or remove Window frame to get rid of decorations. Task-number: QTBUG-28611 Change-Id: Idb6ee94fb8d0760d5f97042b3084557f11e9fdf9 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp2
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp9
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp9
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp9
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp26
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp8
-rw-r--r--tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp17
8 files changed, 81 insertions, 1 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index bd72e643ed..9a41eeab5a 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -1945,6 +1945,7 @@ void tst_QApplication::touchEventPropagation()
{
// touch event behavior on a window
TouchEventPropagationTestWidget window;
+ window.resize(200, 200);
window.setObjectName("1. window");
window.show(); // Must have an explicitly specified QWindow for handleTouchEvent,
// passing 0 would result in using topLevelAt() which is not ok in this case
@@ -1999,6 +2000,7 @@ void tst_QApplication::touchEventPropagation()
{
// touch event behavior on a window with a child widget
TouchEventPropagationTestWidget window;
+ window.resize(200, 200);
window.setObjectName("2. window");
TouchEventPropagationTestWidget widget(&window);
widget.setObjectName("2. widget");
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index 4f1615a48e..f1e2c94966 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -44,6 +44,14 @@
#include <QtGui>
#include <QtWidgets>
+static inline void setFrameless(QWidget *w)
+{
+ Qt::WindowFlags flags = w->windowFlags();
+ flags |= Qt::FramelessWindowHint;
+ flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ w->setWindowFlags(flags);
+}
+
class tst_QBoxLayout : public QObject
{
Q_OBJECT
@@ -198,6 +206,7 @@ void tst_QBoxLayout::sizeConstraints()
void tst_QBoxLayout::setGeometry()
{
QWidget toplevel;
+ setFrameless(&toplevel);
QWidget w(&toplevel);
QVBoxLayout *lay = new QVBoxLayout;
lay->setMargin(0);
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index b2cdb87221..64c549c3c2 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -55,6 +55,14 @@
#include <qformlayout.h>
+static inline void setFrameless(QWidget *w)
+{
+ Qt::WindowFlags flags = w->windowFlags();
+ flags |= Qt::FramelessWindowHint;
+ flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ w->setWindowFlags(flags);
+}
+
class tst_QFormLayout : public QObject
{
Q_OBJECT
@@ -345,6 +353,7 @@ void tst_QFormLayout::spacing()
void tst_QFormLayout::contentsRect()
{
QWidget w;
+ setFrameless(&w);
QFormLayout form;
w.setLayout(&form);
form.addRow("Label", new QPushButton(&w));
diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
index 6b01212e1d..827821b55a 100644
--- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
+++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp
@@ -57,6 +57,14 @@
#include <QRadioButton>
#include <private/qlayoutengine_p.h>
+static inline void setFrameless(QWidget *w)
+{
+ Qt::WindowFlags flags = w->windowFlags();
+ flags |= Qt::FramelessWindowHint;
+ flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ w->setWindowFlags(flags);
+}
+
class tst_QLayout : public QObject
{
Q_OBJECT
@@ -126,6 +134,7 @@ void tst_QLayout::geometry()
// should be the same.
QApplication::setStyle(QStyleFactory::create(QLatin1String("Windows")));
QWidget topLevel;
+ setFrameless(&topLevel);
QWidget w(&topLevel);
QVBoxLayout layout(&w);
SizeHinterFrame widget(QSize(100,100));
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index d65a98d7ba..2b9ea6ad4f 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -213,7 +213,7 @@ void tst_QShortcut::initTestCase()
mainW = new QMainWindow(0);
mainW->setWindowFlags(Qt::X11BypassWindowManagerHint);
edit = new TestEdit(mainW, "test_edit");
- mainW->setFixedSize( 100, 100 );
+ mainW->setFixedSize( 200, 200 );
mainW->setCentralWidget( edit );
mainW->show();
mainW->activateWindow();
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index a24f69b35e..92c7eaecec 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -154,6 +154,16 @@ bool macHasAccessToWindowsServer()
}
#endif
+// Make a widget frameless to prevent size constraints of title bars
+// from interfering (Windows).
+static inline void setFrameless(QWidget *w)
+{
+ Qt::WindowFlags flags = w->windowFlags();
+ flags |= Qt::FramelessWindowHint;
+ flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ w->setWindowFlags(flags);
+}
+
class tst_QWidget : public QObject
{
Q_OBJECT
@@ -1969,6 +1979,7 @@ void tst_QWidget::showMaximized()
{
QWidget widget;
+ setFrameless(&widget);
widget.setGeometry(0, 0, 10, 10);
widget.showMaximized();
QTRY_VERIFY(widget.size().width() > 20 && widget.size().height() > 20);
@@ -2080,6 +2091,7 @@ void tst_QWidget::resizeEvent()
{
{
QWidget wParent;
+ wParent.resize(200, 200);
ResizeWidget wChild(&wParent);
wParent.show();
QCOMPARE (wChild.m_resizeEventCount, 1); // initial resize event before paint
@@ -2095,6 +2107,7 @@ void tst_QWidget::resizeEvent()
{
ResizeWidget wTopLevel;
+ wTopLevel.resize(200, 200);
wTopLevel.show();
QCOMPARE (wTopLevel.m_resizeEventCount, 1); // initial resize event before paint for toplevels
wTopLevel.hide();
@@ -2182,6 +2195,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
//testing deletion of the focusWidget
{
QWidget window;
+ window.resize(200, 200);
QWidget *child = new QWidget(&window);
child->setFocusPolicy(Qt::StrongFocus);
window.show();
@@ -2199,6 +2213,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
//testing reparenting the focus widget
{
QWidget window;
+ window.resize(200, 200);
QWidget *child = new QWidget(&window);
child->setFocusPolicy(Qt::StrongFocus);
window.show();
@@ -2216,6 +2231,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
//testing setEnabled(false)
{
QWidget window;
+ window.resize(200, 200);
QWidget *child = new QWidget(&window);
child->setFocusPolicy(Qt::StrongFocus);
window.show();
@@ -2233,6 +2249,7 @@ void tst_QWidget::showMinimizedKeepsFocus()
//testing clearFocus
{
QWidget window;
+ window.resize(200, 200);
QWidget *firstchild = new QWidget(&window);
firstchild->setFocusPolicy(Qt::StrongFocus);
QWidget *child = new QWidget(&window);
@@ -4501,6 +4518,7 @@ void tst_QWidget::setWindowGeometry()
void tst_QWidget::setGeometry_win()
{
QWidget widget;
+ setFrameless(&widget);
widget.setGeometry(0, 600, 100,100);
widget.show();
widget.setWindowState(widget.windowState() | Qt::WindowMaximized);
@@ -5727,6 +5745,7 @@ void tst_QWidget::childEvents()
{
// no children created, not shown
QWidget widget;
+ widget.resize(200, 200);
EventRecorder spy;
widget.installEventFilter(&spy);
@@ -5746,6 +5765,7 @@ void tst_QWidget::childEvents()
{
// no children, shown
QWidget widget;
+ widget.resize(200, 200);
EventRecorder spy;
widget.installEventFilter(&spy);
@@ -5786,6 +5806,7 @@ void tst_QWidget::childEvents()
{
// 2 children, not shown
QWidget widget;
+ widget.resize(200, 200);
EventRecorder spy;
widget.installEventFilter(&spy);
@@ -5821,6 +5842,7 @@ void tst_QWidget::childEvents()
{
// 2 children, widget shown
QWidget widget;
+ widget.resize(200, 200);
EventRecorder spy;
widget.installEventFilter(&spy);
@@ -5877,6 +5899,7 @@ void tst_QWidget::childEvents()
{
// 2 children, but one is reparented away, not shown
QWidget widget;
+ widget.resize(200, 200);
EventRecorder spy;
widget.installEventFilter(&spy);
@@ -5913,6 +5936,7 @@ void tst_QWidget::childEvents()
{
// 2 children, but one is reparented away, then widget is shown
QWidget widget;
+ widget.resize(200, 200);
EventRecorder spy;
widget.installEventFilter(&spy);
@@ -7328,6 +7352,7 @@ void tst_QWidget::alienWidgets()
QWidget *toolBar = new QWidget(&mainWindow);
QWidget *dockWidget = new QWidget(&mainWindow);
QWidget *centralWidget = new QWidget(&mainWindow);
+ centralWidget->setMinimumSize(QSize(200, 200));
QWidget *button = new QWidget(centralWidget);
QWidget *mdiArea = new QWidget(centralWidget);
@@ -7844,6 +7869,7 @@ void tst_QWidget::immediateRepaintAfterInvalidateBuffer()
void tst_QWidget::effectiveWinId()
{
QWidget parent;
+ parent.resize(200, 200);
QWidget child(&parent);
// Shouldn't crash.
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 058831af2e..0c94e05e61 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -53,6 +53,13 @@
#include <qpushbutton.h>
#include <qboxlayout.h>
+static inline void setFrameless(QWidget *w)
+{
+ Qt::WindowFlags flags = w->windowFlags();
+ flags |= Qt::FramelessWindowHint;
+ flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ w->setWindowFlags(flags);
+}
class tst_QWidget_window : public QWidget
{
@@ -116,6 +123,7 @@ void tst_QWidget_window::tst_min_max_size()
const QSize minSize(300, 400);
const QSize maxSize(1000, 500);
QWidget w1;
+ setFrameless(&w1);
(new QVBoxLayout(&w1))->addWidget(new QPushButton("Test"));
if (setMinMaxSizeBeforeShow) {
w1.setMinimumSize(minSize);
diff --git a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
index a6fac44c2a..68a62e6432 100644
--- a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
+++ b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
@@ -51,6 +51,14 @@
#include <qmainwindow.h>
#include <qmenubar.h>
+static inline void setFrameless(QWidget *w)
+{
+ Qt::WindowFlags flags = w->windowFlags();
+ flags |= Qt::FramelessWindowHint;
+ flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
+ w->setWindowFlags(flags);
+}
+
class tst_QWidgetAction : public QObject
{
Q_OBJECT
@@ -98,6 +106,7 @@ void tst_QWidgetAction::defaultWidget()
}
{
QPointer<QComboBox> combo = new QComboBox(0);
+ setFrameless(combo.data());
combo->show();
QWidgetAction *action = new QWidgetAction(0);
@@ -110,8 +119,10 @@ void tst_QWidgetAction::defaultWidget()
}
{
QToolBar tb1;
+ setFrameless(&tb1);
tb1.show();
QToolBar tb2;
+ setFrameless(&tb2);
tb2.show();
QPointer<QComboBox> combo = new QComboBox(0);
@@ -175,6 +186,7 @@ void tst_QWidgetAction::visibilityUpdate()
// actually keeping the widget's state in sync with the
// action in terms of visibility is QToolBar's responsibility.
QToolBar tb;
+ setFrameless(&tb);
tb.show();
QComboBox *combo = new QComboBox(0);
@@ -213,8 +225,10 @@ QWidget *ComboAction::createWidget(QWidget *parent)
void tst_QWidgetAction::customWidget()
{
QToolBar tb1;
+ setFrameless(&tb1);
tb1.show();
QToolBar tb2;
+ setFrameless(&tb2);
tb2.show();
ComboAction *action = new ComboAction(0);
@@ -273,6 +287,7 @@ void tst_QWidgetAction::visibility()
a->setDefaultWidget(combo);
QToolBar *tb = new QToolBar;
+ setFrameless(tb);
tb->addAction(a);
QVERIFY(!combo->isVisible());
tb->show();
@@ -292,6 +307,7 @@ void tst_QWidgetAction::visibility()
QVERIFY(!combo->isVisible());
QToolBar *tb2 = new QToolBar;
+ setFrameless(tb2);
tb->removeAction(a);
tb2->addAction(a);
QVERIFY(!combo->isVisible());
@@ -308,6 +324,7 @@ void tst_QWidgetAction::visibility()
void tst_QWidgetAction::setEnabled()
{
QToolBar toolbar;
+ setFrameless(&toolbar);
QComboBox *combobox = new QComboBox;
QAction *action = toolbar.addWidget(combobox);
toolbar.show();