summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-01-06 14:36:21 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-01-06 15:05:12 (GMT)
commit94759a0ed565b21c8dbfb4b12bfe6064f156b410 (patch)
tree617a60355fa612c0ca2a8a07cf5279eb6fc28eb0 /tests
parent092f2014cf81d9f58670ede7d381022dd6903cbb (diff)
downloadQt-94759a0ed565b21c8dbfb4b12bfe6064f156b410.zip
Qt-94759a0ed565b21c8dbfb4b12bfe6064f156b410.tar.gz
Qt-94759a0ed565b21c8dbfb4b12bfe6064f156b410.tar.bz2
QBoxLayout::setGeometry would not respect the widget min/max width
When calling heightforWidth after a geometry change, the width actually used could be outside the widget's width bounds. The height could then be smaller than needed to fit the widget's contents resulting in a clipped widget being drawn. Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-7103
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qboxlayout/tst_qboxlayout.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp
index 8887288..48235e8 100644
--- a/tests/auto/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp
@@ -66,6 +66,8 @@ private slots:
void sizeConstraints();
void setGeometry();
void setStyleShouldChangeSpacing();
+
+ void taskQTBUG_7103_minMaxWidthNotRespected();
};
class CustomLayoutStyle : public QWindowsStyle
@@ -246,6 +248,31 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing()
delete style2;
}
+void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected()
+{
+ QLabel *label = new QLabel("Qt uses standard C++, but makes extensive use of the C pre-processor to enrich the language. Qt can also be used in several other programming languages via language bindings. It runs on all major platforms, and has extensive internationalization support. Non-GUI features include SQL database access, XML parsing, thread management, network support and a unified cross-platform API for file handling.");
+ label->setWordWrap(true);
+ label->setFixedWidth(200);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ layout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));
+
+ QWidget widget;
+ widget.setLayout(layout);
+ widget.show();
+ QTest::qWaitForWindowShown(&widget);
+
+ int height = label->height();
+
+ QRect g = widget.geometry();
+ g.setWidth(600);
+ widget.setGeometry(g);
+
+ QTest::qWait(50);
+
+ QCOMPARE(label->height(), height);
+}
QTEST_MAIN(tst_QBoxLayout)
#include "tst_qboxlayout.moc"