tests/auto/qboxlayout/tst_qboxlayout.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the test suite of the Qt Toolkit.
     7 ** This file is part of the test suite of the Qt Toolkit.
     8 **
     8 **
    64     void insertSpacerItem();
    64     void insertSpacerItem();
    65     void sizeHint();
    65     void sizeHint();
    66     void sizeConstraints();
    66     void sizeConstraints();
    67     void setGeometry();
    67     void setGeometry();
    68     void setStyleShouldChangeSpacing();
    68     void setStyleShouldChangeSpacing();
       
    69 
       
    70     void taskQTBUG_7103_minMaxWidthNotRespected();
    69 };
    71 };
    70 
    72 
    71 class CustomLayoutStyle : public QWindowsStyle
    73 class CustomLayoutStyle : public QWindowsStyle
    72 {
    74 {
    73     Q_OBJECT
    75     Q_OBJECT
   244     delete window;
   246     delete window;
   245     delete style1;
   247     delete style1;
   246     delete style2;
   248     delete style2;
   247 }
   249 }
   248 
   250 
       
   251 void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected()
       
   252 {
       
   253     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.");
       
   254     label->setWordWrap(true);
       
   255     label->setFixedWidth(200);
       
   256 
       
   257     QVBoxLayout *layout = new QVBoxLayout;
       
   258     layout->addWidget(label);
       
   259     layout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding));
       
   260 
       
   261     QWidget widget;
       
   262     widget.setLayout(layout);
       
   263     widget.show();
       
   264     QTest::qWaitForWindowShown(&widget);
       
   265 
       
   266     int height = label->height();
       
   267 
       
   268     QRect g = widget.geometry();
       
   269     g.setWidth(600);
       
   270     widget.setGeometry(g);
       
   271 
       
   272     QTest::qWait(50);
       
   273 
       
   274     QCOMPARE(label->height(), height);
       
   275 }
   249 
   276 
   250 QTEST_MAIN(tst_QBoxLayout)
   277 QTEST_MAIN(tst_QBoxLayout)
   251 #include "tst_qboxlayout.moc"
   278 #include "tst_qboxlayout.moc"