tests/auto/qsplitter/tst_qsplitter.cpp
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the test suite of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 
       
    43 #include <QtTest/QtTest>
       
    44 #include <qapplication.h>
       
    45 #include <qsplitter.h>
       
    46 #include <qstyle.h>
       
    47 #include <qfile.h>
       
    48 #include <qtextstream.h>
       
    49 #include <qlayout.h>
       
    50 #include <qabstractscrollarea.h>
       
    51 #include <qgraphicsview.h>
       
    52 #include <qmdiarea.h>
       
    53 #include <qscrollarea.h>
       
    54 #include <qtextedit.h>
       
    55 #include <qtreeview.h>
       
    56 #include <qlabel.h>
       
    57 #include <qdebug.h> // for file error messages
       
    58 #include "../../shared/util.h"
       
    59 
       
    60 #if defined(Q_OS_SYMBIAN)
       
    61 # define SRCDIR ""
       
    62 #endif
       
    63 
       
    64 //TESTED_CLASS=
       
    65 //TESTED_FILES=
       
    66 
       
    67 QT_FORWARD_DECLARE_CLASS(QSplitter)
       
    68 QT_FORWARD_DECLARE_CLASS(QWidget)
       
    69 class tst_QSplitter : public QObject
       
    70 {
       
    71     Q_OBJECT
       
    72 
       
    73 public:
       
    74     tst_QSplitter();
       
    75     virtual ~tst_QSplitter();
       
    76 
       
    77 public slots:
       
    78     void initTestCase();
       
    79     void cleanupTestCase();
       
    80     void init();
       
    81 private slots:
       
    82     void getSetCheck();
       
    83     void sizes(); // bare (as in empty)
       
    84     void setSizes3();
       
    85     void setSizes3_data();
       
    86     void setSizes();
       
    87     void setSizes_data();
       
    88     void saveAndRestoreState();
       
    89     void saveAndRestoreState_data();
       
    90     void saveState_data();
       
    91     void addWidget();
       
    92     void insertWidget();
       
    93     void setStretchFactor_data();
       
    94     void setStretchFactor();
       
    95     void testShowHide_data();
       
    96     void testShowHide();
       
    97     void testRemoval();
       
    98     void rubberBandNotInSplitter();
       
    99     void saveAndRestoreStateOfNotYetShownSplitter();
       
   100 
       
   101     // task-specific tests below me:
       
   102     void task187373_addAbstractScrollAreas();
       
   103     void task187373_addAbstractScrollAreas_data();
       
   104     void task169702_sizes();
       
   105 
       
   106 private:
       
   107     void removeThirdWidget();
       
   108     void addThirdWidget();
       
   109     QSplitter *splitter;
       
   110     QWidget *w1;
       
   111     QWidget *w2;
       
   112     QWidget *w3;
       
   113 };
       
   114 
       
   115 // Testing get/set functions
       
   116 void tst_QSplitter::getSetCheck()
       
   117 {
       
   118     QSplitter obj1;
       
   119     // bool QSplitter::opaqueResize()
       
   120     // void QSplitter::setOpaqueResize(bool)
       
   121     obj1.setOpaqueResize(false);
       
   122     QCOMPARE(false, obj1.opaqueResize());
       
   123     obj1.setOpaqueResize(true);
       
   124     QCOMPARE(true, obj1.opaqueResize());
       
   125 }
       
   126 
       
   127 tst_QSplitter::tst_QSplitter()
       
   128     : w1(0), w2(0), w3(0)
       
   129 {
       
   130 }
       
   131 
       
   132 tst_QSplitter::~tst_QSplitter()
       
   133 {
       
   134 }
       
   135 
       
   136 void tst_QSplitter::sizes()
       
   137 {
       
   138     DEPENDS_ON("setSizes");
       
   139 }
       
   140 
       
   141 void tst_QSplitter::initTestCase()
       
   142 {
       
   143     splitter = new QSplitter(Qt::Horizontal);
       
   144     w1 = new QWidget;
       
   145     w2 = new QWidget;
       
   146     splitter->addWidget(w1);
       
   147     splitter->addWidget(w2);
       
   148 #if defined(QT3_SUPPORT)
       
   149     qApp->setMainWidget(splitter);
       
   150 #endif
       
   151 }
       
   152 
       
   153 void tst_QSplitter::init()
       
   154 {
       
   155     removeThirdWidget();
       
   156     w1->show();
       
   157     w2->show();
       
   158     w1->setMinimumSize(0, 0);
       
   159     w2->setMinimumSize(0, 0);
       
   160     splitter->setSizes(QList<int>() << 200 << 200);
       
   161     qApp->sendPostedEvents();
       
   162 }
       
   163 
       
   164 void tst_QSplitter::removeThirdWidget()
       
   165 {
       
   166     delete w3;
       
   167     w3 = 0;
       
   168     int handleWidth = splitter->style()->pixelMetric(QStyle::PM_SplitterWidth);
       
   169     splitter->setFixedSize(400 + handleWidth, 400);
       
   170 }
       
   171 
       
   172 void tst_QSplitter::addThirdWidget()
       
   173 {
       
   174     if (!w3) {
       
   175         w3 = new QWidget;
       
   176         splitter->addWidget(w3);
       
   177         int handleWidth = splitter->style()->pixelMetric(QStyle::PM_SplitterWidth);
       
   178         splitter->setFixedSize(600 + 2 * handleWidth, 400);
       
   179     }
       
   180 }
       
   181 
       
   182 void tst_QSplitter::cleanupTestCase()
       
   183 {
       
   184 #if defined(QT3_SUPPORT)
       
   185     delete qApp->mainWidget();
       
   186 #endif
       
   187 }
       
   188 
       
   189 
       
   190 typedef QList<int> IntList;
       
   191 Q_DECLARE_METATYPE(IntList)
       
   192 
       
   193 void tst_QSplitter::setSizes3()
       
   194 {
       
   195     QFETCH(IntList, minimumSizes);
       
   196     QFETCH(IntList, splitterSizes);
       
   197     QFETCH(IntList, collapsibleStates);
       
   198     QFETCH(bool, childrenCollapse);
       
   199 
       
   200     QCOMPARE(minimumSizes.size(), splitterSizes.size());
       
   201     if (minimumSizes.size() > 2)
       
   202         addThirdWidget();
       
   203     for (int i = 0; i < minimumSizes.size(); ++i) {
       
   204         QWidget *w = splitter->widget(i);
       
   205         w->setMinimumWidth(minimumSizes.at(i));
       
   206         splitter->setCollapsible(splitter->indexOf(w), collapsibleStates.at(i));
       
   207     }
       
   208     splitter->setChildrenCollapsible(childrenCollapse);
       
   209     splitter->setSizes(splitterSizes);
       
   210     QTEST(splitter->sizes(), "expectedSizes");
       
   211 }
       
   212 
       
   213 void tst_QSplitter::setSizes3_data()
       
   214 {
       
   215     QTest::addColumn<IntList>("minimumSizes");
       
   216     QTest::addColumn<IntList>("splitterSizes");
       
   217     QTest::addColumn<IntList>("expectedSizes");
       
   218     QTest::addColumn<IntList>("collapsibleStates");
       
   219     QTest::addColumn<bool>("childrenCollapse");
       
   220 
       
   221     QFile file(SRCDIR "setSizes3.dat");
       
   222     if (!file.open(QIODevice::ReadOnly)) {
       
   223         qDebug() << "Can't open file, reason:" << file.errorString();
       
   224         return;
       
   225     }
       
   226     QTextStream ts(&file);
       
   227     ts.setIntegerBase(10);
       
   228 
       
   229     QString dataName;
       
   230     IntList minimumSizes;
       
   231     IntList splitterSizes;
       
   232     IntList expectedSizes;
       
   233     IntList collapsibleStates;
       
   234     int childrenCollapse;
       
   235     while (!ts.atEnd()) {
       
   236         int i1, i2, i3;
       
   237         minimumSizes.clear();
       
   238         splitterSizes.clear();
       
   239         expectedSizes.clear();
       
   240         collapsibleStates.clear();
       
   241         ts >> dataName;
       
   242         ts >> i1 >> i2 >> i3;
       
   243         minimumSizes << i1 << i2 << i3;
       
   244         ts >> i1 >> i2 >> i3;
       
   245         splitterSizes << i1 << i2 << i3;
       
   246         ts >> i1 >> i2 >> i3;
       
   247         expectedSizes << i1 << i2 << i3;
       
   248         ts >> i1 >> i2 >> i3;
       
   249         collapsibleStates << i1 << i2 << i3;
       
   250         ts >> childrenCollapse;
       
   251         QTest::newRow(dataName.toLocal8Bit()) << minimumSizes << splitterSizes << expectedSizes << collapsibleStates << bool(childrenCollapse);
       
   252         ts.skipWhiteSpace();
       
   253     }
       
   254 }
       
   255 
       
   256 void tst_QSplitter::setSizes()
       
   257 {
       
   258 #if !defined(QT3_SUPPORT)
       
   259     QSKIP("No Qt3Support", SkipAll);
       
   260 #else
       
   261     QFETCH(int, minSize1);
       
   262     QFETCH(int, minSize2);
       
   263     QFETCH(int, splitterSize1);
       
   264     QFETCH(int, splitterSize2);
       
   265     QFETCH(bool, collapse1);
       
   266     QFETCH(bool, collapse2);
       
   267     QFETCH(bool, childrencollapse);
       
   268     QFETCH(int, resizeMode1);
       
   269     QFETCH(int, resizeMode2);
       
   270     QList<int> mySizes;
       
   271     mySizes << splitterSize1 << splitterSize2;
       
   272     w1->setMinimumWidth(minSize1);
       
   273     w2->setMinimumWidth(minSize2);
       
   274     splitter->setCollapsible(w1, collapse1);
       
   275     splitter->setCollapsible(w2, collapse2);
       
   276     splitter->setChildrenCollapsible(childrencollapse);
       
   277     splitter->setResizeMode(w1, (QSplitter::ResizeMode)resizeMode1);
       
   278     splitter->setResizeMode(w2, (QSplitter::ResizeMode)resizeMode2);
       
   279     splitter->setSizes(mySizes);
       
   280     mySizes = splitter->sizes();
       
   281     QTEST(mySizes[0], "expected1");
       
   282     QTEST(mySizes[1], "expected2");
       
   283 #endif
       
   284 }
       
   285 
       
   286 void tst_QSplitter::setSizes_data()
       
   287 {
       
   288 #if defined(QT3_SUPPORT)
       
   289     QTest::addColumn<int>("minSize1");
       
   290     QTest::addColumn<int>("minSize2");
       
   291     QTest::addColumn<int>("splitterSize1");
       
   292     QTest::addColumn<int>("splitterSize2");
       
   293     QTest::addColumn<int>("expected1");
       
   294     QTest::addColumn<int>("expected2");
       
   295     QTest::addColumn<bool>("collapse1");
       
   296     QTest::addColumn<bool>("collapse2");
       
   297     QTest::addColumn<bool>("childrencollapse");
       
   298     QTest::addColumn<int>("resizeMode1");
       
   299     QTest::addColumn<int>("resizeMode2");
       
   300     QTest::newRow("ok00") << 100 << 50 << 100 << 300 << 100 << 300
       
   301 			 << (bool)true << (bool)true << (bool)true
       
   302 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   303     QTest::newRow("ok01") << 100 << 100 << 50 << 350 << 100 << 300
       
   304 			 << (bool)true << (bool)true << (bool)true
       
   305 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   306     QTest::newRow("ok02") << 100 << 100 << 350 << 50 << 300 << 100
       
   307 			 << (bool)true << (bool)true << (bool)true
       
   308 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   309     QTest::newRow("ok03") << 200 << 200 << 350 << 50 << 200 << 200
       
   310 			 << (bool)true << (bool)true << (bool)true
       
   311 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   312     QTest::newRow("ok04") << 200 << 200 << 200 << 200 << 200 << 200
       
   313 			 << (bool)true << (bool)true << (bool)true
       
   314 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   315     QTest::newRow("ok05") << 200 << 200 << 0 << 350 << 0 << 400
       
   316 			 << (bool)true << (bool)true << (bool)true
       
   317 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   318     QTest::newRow("ok06") << 200 << 200 << 350 << 0 << 400 << 0
       
   319 			 << (bool)true << (bool)true << (bool)true
       
   320 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   321     QTest::newRow("ok07") << 200 << 200 << 350 << 0 << 200 << 200
       
   322 			 << (bool)true << (bool)false << (bool)true
       
   323 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   324     QTest::newRow("ok08") << 200 << 200 << 350 << 0 << 200 << 200
       
   325 			 << (bool)false << (bool)false << (bool)true
       
   326 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   327     QTest::newRow("ok09") << 200 << 200 << 0 << 350 << 200 << 200
       
   328 			 << (bool)false << (bool)true << (bool)true
       
   329 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   330     QTest::newRow("ok10") << 200 << 200 << 0 << 350 << 200 << 200
       
   331 			 << (bool)false << (bool)false << (bool)true
       
   332 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   333 
       
   334     QTest::newRow("ok20") << 100 << 50 << 100 << 300 << 100 << 300
       
   335 			 << (bool)true << (bool)true << (bool)false
       
   336 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   337     QTest::newRow("ok21") << 100 << 100 << 50 << 350 << 100 << 300
       
   338 			 << (bool)true << (bool)true << (bool)false
       
   339 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   340     QTest::newRow("ok22") << 100 << 100 << 350 << 50 << 300 << 100
       
   341 			 << (bool)true << (bool)true << (bool)false
       
   342 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   343     QTest::newRow("ok23") << 200 << 200 << 350 << 50 << 200 << 200
       
   344 			 << (bool)true << (bool)true << (bool)false
       
   345 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   346     QTest::newRow("ok24") << 200 << 200 << 200 << 200 << 200 << 200
       
   347 			 << (bool)true << (bool)true << (bool)false
       
   348 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   349     QTest::newRow("ok25") << 200 << 200 << 0 << 350 << 0 << 400
       
   350 			 << (bool)true << (bool)true << (bool)false
       
   351 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   352     QTest::newRow("ok26") << 200 << 200 << 350 << 0 << 400 << 0
       
   353 			 << (bool)true << (bool)true << (bool)false
       
   354 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   355     QTest::newRow("ok27") << 200 << 200 << 350 << 0 << 200 << 200
       
   356 			 << (bool)true << (bool)false << (bool)false
       
   357 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   358     QTest::newRow("ok28") << 200 << 200 << 350 << 0 << 200 << 200
       
   359 			 << (bool)false << (bool)false << (bool)false
       
   360 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   361     QTest::newRow("ok29") << 200 << 200 << 0 << 350 << 200 << 200
       
   362 			 << (bool)false << (bool)true << (bool)false
       
   363 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   364     QTest::newRow("ok30") << 200 << 200 << 0 << 350 << 200 << 200
       
   365 			 << (bool)false << (bool)false << (bool)false
       
   366 			 << (int)QSplitter::Auto << (int)QSplitter::Auto;
       
   367     QTest::newRow("ok40") << 100 << 50 << 100 << 300 << 100 << 300
       
   368 			 << (bool)true << (bool)true << (bool)false
       
   369 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   370     QTest::newRow("ok41") << 100 << 100 << 50 << 350 << 100 << 300
       
   371 			 << (bool)true << (bool)true << (bool)false
       
   372 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   373     QTest::newRow("ok42") << 100 << 100 << 350 << 50 << 300 << 100
       
   374 			 << (bool)true << (bool)true << (bool)false
       
   375 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   376     QTest::newRow("ok43") << 200 << 200 << 350 << 50 << 200 << 200
       
   377 			 << (bool)true << (bool)true << (bool)false
       
   378 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   379     QTest::newRow("ok44") << 200 << 200 << 200 << 200 << 200 << 200
       
   380 			 << (bool)true << (bool)true << (bool)false
       
   381 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   382     QTest::newRow("ok45") << 200 << 200 << 0 << 350 << 0 << 400
       
   383 			 << (bool)true << (bool)true << (bool)false
       
   384 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   385     QTest::newRow("ok46") << 200 << 200 << 350 << 0 << 400 << 0
       
   386 			 << (bool)true << (bool)true << (bool)false
       
   387 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   388     QTest::newRow("ok47") << 200 << 200 << 350 << 0 << 200 << 200
       
   389 			 << (bool)true << (bool)false << (bool)false
       
   390 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   391     QTest::newRow("ok48") << 200 << 200 << 350 << 0 << 200 << 200
       
   392 			 << (bool)false << (bool)false << (bool)false
       
   393 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   394     QTest::newRow("ok49") << 200 << 200 << 0 << 350 << 200 << 200
       
   395 			 << (bool)false << (bool)true << (bool)false
       
   396 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   397     QTest::newRow("ok50") << 200 << 200 << 0 << 350 << 200 << 200
       
   398 			 << (bool)false << (bool)false << (bool)false
       
   399 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   400 
       
   401     QTest::newRow("ok60") << 100 << 50 << 100 << 300 << 100 << 300
       
   402 			 << (bool)true << (bool)true << (bool)true
       
   403 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   404     QTest::newRow("ok61") << 100 << 100 << 50 << 350 << 100 << 300
       
   405 			 << (bool)true << (bool)true << (bool)true
       
   406 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   407     QTest::newRow("ok62") << 100 << 100 << 350 << 50 << 300 << 100
       
   408 			 << (bool)true << (bool)true << (bool)true
       
   409 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   410     QTest::newRow("ok63") << 200 << 200 << 350 << 50 << 200 << 200
       
   411 			 << (bool)true << (bool)true << (bool)true
       
   412 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   413     QTest::newRow("ok64") << 200 << 200 << 200 << 200 << 200 << 200
       
   414 			 << (bool)true << (bool)true << (bool)true
       
   415 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   416     QTest::newRow("ok65") << 200 << 200 << 0 << 350 << 0 << 400
       
   417 			 << (bool)true << (bool)true << (bool)true
       
   418 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   419     QTest::newRow("ok66") << 200 << 200 << 350 << 0 << 400 << 0
       
   420 			 << (bool)true << (bool)true << (bool)true
       
   421 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   422     QTest::newRow("ok67") << 200 << 200 << 350 << 0 << 200 << 200
       
   423 			 << (bool)true << (bool)false << (bool)true
       
   424 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   425     QTest::newRow("ok68") << 200 << 200 << 350 << 0 << 200 << 200
       
   426 			 << (bool)false << (bool)false << (bool)true
       
   427 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   428     QTest::newRow("ok69") << 200 << 200 << 0 << 350 << 200 << 200
       
   429 			 << (bool)false << (bool)true << (bool)true
       
   430 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   431     QTest::newRow("ok70") << 200 << 200 << 0 << 350 << 200 << 200
       
   432 			 << (bool)false << (bool)false << (bool)true
       
   433 			 << (int)QSplitter::Stretch << (int)QSplitter::Auto;
       
   434 
       
   435     QTest::newRow("ok80") << 100 << 50 << 100 << 300 << 100 << 300
       
   436 			 << (bool)true << (bool)true << (bool)true
       
   437 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   438     QTest::newRow("ok81") << 100 << 100 << 50 << 350 << 100 << 300
       
   439 			 << (bool)true << (bool)true << (bool)true
       
   440 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   441     QTest::newRow("ok82") << 100 << 100 << 350 << 50 << 300 << 100
       
   442 			 << (bool)true << (bool)true << (bool)true
       
   443 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   444     QTest::newRow("ok83") << 200 << 200 << 350 << 50 << 200 << 200
       
   445 			 << (bool)true << (bool)true << (bool)true
       
   446 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   447     QTest::newRow("ok84") << 200 << 200 << 200 << 200 << 200 << 200
       
   448 			 << (bool)true << (bool)true << (bool)true
       
   449 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   450     QTest::newRow("ok85") << 200 << 200 << 0 << 350 << 0 << 400
       
   451 			 << (bool)true << (bool)true << (bool)true
       
   452 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   453     QTest::newRow("ok86") << 200 << 200 << 350 << 0 << 400 << 0
       
   454 			 << (bool)true << (bool)true << (bool)true
       
   455 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   456     QTest::newRow("ok87") << 200 << 200 << 350 << 0 << 200 << 200
       
   457 			 << (bool)true << (bool)false << (bool)true
       
   458 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   459     QTest::newRow("ok88") << 200 << 200 << 350 << 0 << 200 << 200
       
   460 			 << (bool)false << (bool)false << (bool)true
       
   461 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   462     QTest::newRow("ok89") << 200 << 200 << 0 << 350 << 200 << 200
       
   463 			 << (bool)false << (bool)true << (bool)true
       
   464 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   465     QTest::newRow("ok90") << 200 << 200 << 0 << 350 << 200 << 200
       
   466 			 << (bool)false << (bool)false << (bool)true
       
   467 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   468 
       
   469     QTest::newRow("ok100") << 100 << 50 << 100 << 300 << 100 << 300
       
   470 			 << (bool)true << (bool)true << (bool)false
       
   471 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   472     QTest::newRow("ok101") << 100 << 100 << 50 << 350 << 100 << 300
       
   473 			 << (bool)true << (bool)true << (bool)false
       
   474 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   475     QTest::newRow("ok102") << 100 << 100 << 350 << 50 << 300 << 100
       
   476 			 << (bool)true << (bool)true << (bool)false
       
   477 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   478     QTest::newRow("ok103") << 200 << 200 << 350 << 50 << 200 << 200
       
   479 			 << (bool)true << (bool)true << (bool)false
       
   480 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   481     QTest::newRow("ok104") << 200 << 200 << 200 << 200 << 200 << 200
       
   482 			 << (bool)true << (bool)true << (bool)false
       
   483 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   484     QTest::newRow("ok105") << 200 << 200 << 0 << 350 << 0 << 400
       
   485 			 << (bool)true << (bool)true << (bool)false
       
   486 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   487     QTest::newRow("ok106") << 200 << 200 << 350 << 0 << 400 << 0
       
   488 			 << (bool)true << (bool)true << (bool)false
       
   489 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   490     QTest::newRow("ok107") << 200 << 200 << 350 << 0 << 200 << 200
       
   491 			 << (bool)true << (bool)false << (bool)false
       
   492 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   493     QTest::newRow("ok108") << 200 << 200 << 350 << 0 << 200 << 200
       
   494 			 << (bool)false << (bool)false << (bool)false
       
   495 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   496     QTest::newRow("ok109") << 200 << 200 << 0 << 350 << 200 << 200
       
   497 			 << (bool)false << (bool)true << (bool)false
       
   498 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   499     QTest::newRow("ok110") << 200 << 200 << 0 << 350 << 200 << 200
       
   500 			 << (bool)false << (bool)false << (bool)false
       
   501 			 << (int)QSplitter::Auto << (int)QSplitter::Stretch;
       
   502 
       
   503     QTest::newRow("ok120") << 100 << 50 << 100 << 300 << 100 << 300
       
   504 			 << (bool)true << (bool)true << (bool)true
       
   505 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   506     QTest::newRow("ok121") << 100 << 100 << 50 << 350 << 100 << 300
       
   507 			 << (bool)true << (bool)true << (bool)true
       
   508 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   509     QTest::newRow("ok122") << 100 << 100 << 350 << 50 << 300 << 100
       
   510 			 << (bool)true << (bool)true << (bool)true
       
   511 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   512     QTest::newRow("ok123") << 200 << 200 << 350 << 50 << 200 << 200
       
   513 			 << (bool)true << (bool)true << (bool)true
       
   514 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   515     QTest::newRow("ok124") << 200 << 200 << 200 << 200 << 200 << 200
       
   516 			 << (bool)true << (bool)true << (bool)true
       
   517 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   518     QTest::newRow("ok125") << 200 << 200 << 0 << 350 << 0 << 400
       
   519 			 << (bool)true << (bool)true << (bool)true
       
   520 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   521     QTest::newRow("ok126") << 200 << 200 << 350 << 0 << 400 << 0
       
   522 			 << (bool)true << (bool)true << (bool)true
       
   523 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   524     QTest::newRow("ok127") << 200 << 200 << 350 << 0 << 200 << 200
       
   525 			 << (bool)true << (bool)false << (bool)true
       
   526 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   527     QTest::newRow("ok128") << 200 << 200 << 350 << 0 << 200 << 200
       
   528 			 << (bool)false << (bool)false << (bool)true
       
   529 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   530     QTest::newRow("ok129") << 200 << 200 << 0 << 350 << 200 << 200
       
   531 			 << (bool)false << (bool)true << (bool)true
       
   532 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   533     QTest::newRow("ok130") << 200 << 200 << 0 << 350 << 200 << 200
       
   534 			 << (bool)false << (bool)false << (bool)true
       
   535 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   536 
       
   537     QTest::newRow("ok140") << 100 << 50 << 100 << 300 << 100 << 300
       
   538 			 << (bool)true << (bool)true << (bool)false
       
   539 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   540     QTest::newRow("ok141") << 100 << 100 << 50 << 350 << 100 << 300
       
   541 			 << (bool)true << (bool)true << (bool)false
       
   542 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   543     QTest::newRow("ok142") << 100 << 100 << 350 << 50 << 300 << 100
       
   544 			 << (bool)true << (bool)true << (bool)false
       
   545 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   546     QTest::newRow("ok143") << 200 << 200 << 350 << 50 << 200 << 200
       
   547 			 << (bool)true << (bool)true << (bool)false
       
   548 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   549     QTest::newRow("ok144") << 200 << 200 << 200 << 200 << 200 << 200
       
   550 			 << (bool)true << (bool)true << (bool)false
       
   551 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   552     QTest::newRow("ok145") << 200 << 200 << 0 << 350 << 0 << 400
       
   553 			 << (bool)true << (bool)true << (bool)false
       
   554 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   555     QTest::newRow("ok146") << 200 << 200 << 350 << 0 << 400 << 0
       
   556 			 << (bool)true << (bool)true << (bool)false
       
   557 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   558     QTest::newRow("ok147") << 200 << 200 << 350 << 0 << 200 << 200
       
   559 			 << (bool)true << (bool)false << (bool)false
       
   560 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   561     QTest::newRow("ok148") << 200 << 200 << 350 << 0 << 200 << 200
       
   562 			 << (bool)false << (bool)false << (bool)false
       
   563 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   564     QTest::newRow("ok149") << 200 << 200 << 0 << 350 << 200 << 200
       
   565 			 << (bool)false << (bool)true << (bool)false
       
   566 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   567     QTest::newRow("ok150") << 200 << 200 << 0 << 350 << 200 << 200
       
   568 			 << (bool)false << (bool)false << (bool)false
       
   569 			 << (int)QSplitter::KeepSize << (int)QSplitter::Auto;
       
   570     QTest::newRow("ok160") << 100 << 50 << 100 << 300 << 100 << 300
       
   571 			 << (bool)true << (bool)true << (bool)true
       
   572 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   573     QTest::newRow("ok161") << 100 << 100 << 50 << 350 << 100 << 300
       
   574 			 << (bool)true << (bool)true << (bool)true
       
   575 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   576     QTest::newRow("ok162") << 100 << 100 << 350 << 50 << 300 << 100
       
   577 			 << (bool)true << (bool)true << (bool)true
       
   578 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   579     QTest::newRow("ok163") << 200 << 200 << 350 << 50 << 200 << 200
       
   580 			 << (bool)true << (bool)true << (bool)true
       
   581 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   582     QTest::newRow("ok164") << 200 << 200 << 200 << 200 << 200 << 200
       
   583 			 << (bool)true << (bool)true << (bool)true
       
   584 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   585     QTest::newRow("ok165") << 200 << 200 << 0 << 350 << 0 << 400
       
   586 			 << (bool)true << (bool)true << (bool)true
       
   587 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   588     QTest::newRow("ok166") << 200 << 200 << 350 << 0 << 400 << 0
       
   589 			 << (bool)true << (bool)true << (bool)true
       
   590 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   591     QTest::newRow("ok167") << 200 << 200 << 350 << 0 << 200 << 200
       
   592 			 << (bool)true << (bool)false << (bool)true
       
   593 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   594     QTest::newRow("ok168") << 200 << 200 << 350 << 0 << 200 << 200
       
   595 			 << (bool)false << (bool)false << (bool)true
       
   596 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   597     QTest::newRow("ok169") << 200 << 200 << 0 << 350 << 200 << 200
       
   598 			 << (bool)false << (bool)true << (bool)true
       
   599 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   600     QTest::newRow("ok170") << 200 << 200 << 0 << 350 << 200 << 200
       
   601 			 << (bool)false << (bool)false << (bool)true
       
   602 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   603     QTest::newRow("ok180") << 100 << 50 << 100 << 300 << 100 << 300
       
   604 			 << (bool)true << (bool)true << (bool)false
       
   605 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   606     QTest::newRow("ok181") << 100 << 100 << 50 << 350 << 100 << 300
       
   607 			 << (bool)true << (bool)true << (bool)false
       
   608 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   609     QTest::newRow("ok182") << 100 << 100 << 350 << 50 << 300 << 100
       
   610 			 << (bool)true << (bool)true << (bool)false
       
   611 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   612     QTest::newRow("ok183") << 200 << 200 << 350 << 50 << 200 << 200
       
   613 			 << (bool)true << (bool)true << (bool)false
       
   614 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   615     QTest::newRow("ok184") << 200 << 200 << 200 << 200 << 200 << 200
       
   616 			 << (bool)true << (bool)true << (bool)false
       
   617 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   618     QTest::newRow("ok185") << 200 << 200 << 0 << 350 << 0 << 400
       
   619 			 << (bool)true << (bool)true << (bool)false
       
   620 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   621     QTest::newRow("ok186") << 200 << 200 << 350 << 0 << 400 << 0
       
   622 			 << (bool)true << (bool)true << (bool)false
       
   623 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   624     QTest::newRow("ok187") << 200 << 200 << 350 << 0 << 200 << 200
       
   625 			 << (bool)true << (bool)false << (bool)false
       
   626 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   627     QTest::newRow("ok188") << 200 << 200 << 350 << 0 << 200 << 200
       
   628 			 << (bool)false << (bool)false << (bool)false
       
   629 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   630     QTest::newRow("ok189") << 200 << 200 << 0 << 350 << 200 << 200
       
   631 			 << (bool)false << (bool)true << (bool)false
       
   632 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   633     QTest::newRow("ok190") << 200 << 200 << 0 << 350 << 200 << 200
       
   634 			 << (bool)false << (bool)false << (bool)false
       
   635 			 << (int)QSplitter::Auto << (int)QSplitter::KeepSize;
       
   636     QTest::newRow("ok200") << 100 << 50 << 100 << 300 << 100 << 300
       
   637 			 << (bool)true << (bool)true << (bool)true
       
   638 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   639     QTest::newRow("ok201") << 100 << 100 << 50 << 350 << 100 << 300
       
   640 			 << (bool)true << (bool)true << (bool)true
       
   641 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   642     QTest::newRow("ok202") << 100 << 100 << 350 << 50 << 300 << 100
       
   643 			 << (bool)true << (bool)true << (bool)true
       
   644 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   645     QTest::newRow("ok203") << 200 << 200 << 350 << 50 << 200 << 200
       
   646 			 << (bool)true << (bool)true << (bool)true
       
   647 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   648     QTest::newRow("ok204") << 200 << 200 << 200 << 200 << 200 << 200
       
   649 			 << (bool)true << (bool)true << (bool)true
       
   650 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   651     QTest::newRow("ok205") << 200 << 200 << 0 << 350 << 0 << 400
       
   652 			 << (bool)true << (bool)true << (bool)true
       
   653 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   654     QTest::newRow("ok206") << 200 << 200 << 350 << 0 << 400 << 0
       
   655 			 << (bool)true << (bool)true << (bool)true
       
   656 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   657     QTest::newRow("ok207") << 200 << 200 << 350 << 0 << 200 << 200
       
   658 			 << (bool)true << (bool)false << (bool)true
       
   659 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   660     QTest::newRow("ok208") << 200 << 200 << 350 << 0 << 200 << 200
       
   661 			 << (bool)false << (bool)false << (bool)true
       
   662 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   663     QTest::newRow("ok209") << 200 << 200 << 0 << 350 << 200 << 200
       
   664 			 << (bool)false << (bool)true << (bool)true
       
   665 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   666     QTest::newRow("ok210") << 200 << 200 << 0 << 350 << 200 << 200
       
   667 			 << (bool)false << (bool)false << (bool)true
       
   668 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   669     QTest::newRow("ok220") << 100 << 50 << 100 << 300 << 100 << 300
       
   670 			 << (bool)true << (bool)true << (bool)false
       
   671 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   672     QTest::newRow("ok221") << 100 << 100 << 50 << 350 << 100 << 300
       
   673 			 << (bool)true << (bool)true << (bool)false
       
   674 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   675     QTest::newRow("ok222") << 100 << 100 << 350 << 50 << 300 << 100
       
   676 			 << (bool)true << (bool)true << (bool)false
       
   677 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   678     QTest::newRow("ok223") << 200 << 200 << 350 << 50 << 200 << 200
       
   679 			 << (bool)true << (bool)true << (bool)false
       
   680 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   681     QTest::newRow("ok224") << 200 << 200 << 200 << 200 << 200 << 200
       
   682 			 << (bool)true << (bool)true << (bool)false
       
   683 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   684     QTest::newRow("ok225") << 200 << 200 << 0 << 350 << 0 << 400
       
   685 			 << (bool)true << (bool)true << (bool)false
       
   686 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   687     QTest::newRow("ok226") << 200 << 200 << 350 << 0 << 400 << 0
       
   688 			 << (bool)true << (bool)true << (bool)false
       
   689 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   690     QTest::newRow("ok227") << 200 << 200 << 350 << 0 << 200 << 200
       
   691 			 << (bool)true << (bool)false << (bool)false
       
   692 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   693     QTest::newRow("ok228") << 200 << 200 << 350 << 0 << 200 << 200
       
   694 			 << (bool)false << (bool)false << (bool)false
       
   695 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   696     QTest::newRow("ok229") << 200 << 200 << 0 << 350 << 200 << 200
       
   697 			 << (bool)false << (bool)true << (bool)false
       
   698 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   699     QTest::newRow("ok230") << 200 << 200 << 0 << 350 << 200 << 200
       
   700 			 << (bool)false << (bool)false << (bool)false
       
   701 			 << (int)QSplitter::Stretch << (int)QSplitter::Stretch;
       
   702     QTest::newRow("ok240") << 100 << 50 << 100 << 300 << 100 << 300
       
   703 			 << (bool)true << (bool)true << (bool)true
       
   704 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   705     QTest::newRow("ok241") << 100 << 100 << 50 << 350 << 100 << 300
       
   706 			 << (bool)true << (bool)true << (bool)true
       
   707 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   708     QTest::newRow("ok242") << 100 << 100 << 350 << 50 << 300 << 100
       
   709 			 << (bool)true << (bool)true << (bool)true
       
   710 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   711     QTest::newRow("ok243") << 200 << 200 << 350 << 50 << 200 << 200
       
   712 			 << (bool)true << (bool)true << (bool)true
       
   713 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   714     QTest::newRow("ok244") << 200 << 200 << 200 << 200 << 200 << 200
       
   715 			 << (bool)true << (bool)true << (bool)true
       
   716 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   717     QTest::newRow("ok245") << 200 << 200 << 0 << 350 << 0 << 400
       
   718 			 << (bool)true << (bool)true << (bool)true
       
   719 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   720     QTest::newRow("ok246") << 200 << 200 << 350 << 0 << 400 << 0
       
   721 			 << (bool)true << (bool)true << (bool)true
       
   722 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   723     QTest::newRow("ok247") << 200 << 200 << 350 << 0 << 200 << 200
       
   724 			 << (bool)true << (bool)false << (bool)true
       
   725 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   726     QTest::newRow("ok248") << 200 << 200 << 350 << 0 << 200 << 200
       
   727 			 << (bool)false << (bool)false << (bool)true
       
   728 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   729     QTest::newRow("ok249") << 200 << 200 << 0 << 350 << 200 << 200
       
   730 			 << (bool)false << (bool)true << (bool)true
       
   731 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   732     QTest::newRow("ok250") << 200 << 200 << 0 << 350 << 200 << 200
       
   733 			 << (bool)false << (bool)false << (bool)true
       
   734 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   735     QTest::newRow("ok260") << 100 << 50 << 100 << 300 << 100 << 300
       
   736 			 << (bool)true << (bool)true << (bool)false
       
   737 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   738     QTest::newRow("ok261") << 100 << 100 << 50 << 350 << 100 << 300
       
   739 			 << (bool)true << (bool)true << (bool)false
       
   740 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   741     QTest::newRow("ok262") << 100 << 100 << 350 << 50 << 300 << 100
       
   742 			 << (bool)true << (bool)true << (bool)false
       
   743 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   744     QTest::newRow("ok263") << 200 << 200 << 350 << 50 << 200 << 200
       
   745 			 << (bool)true << (bool)true << (bool)false
       
   746 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   747     QTest::newRow("ok264") << 200 << 200 << 200 << 200 << 200 << 200
       
   748 			 << (bool)true << (bool)true << (bool)false
       
   749 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   750     QTest::newRow("ok265") << 200 << 200 << 0 << 350 << 0 << 400
       
   751 			 << (bool)true << (bool)true << (bool)false
       
   752 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   753     QTest::newRow("ok266") << 200 << 200 << 350 << 0 << 400 << 0
       
   754 			 << (bool)true << (bool)true << (bool)false
       
   755 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   756     QTest::newRow("ok267") << 200 << 200 << 350 << 0 << 200 << 200
       
   757 			 << (bool)true << (bool)false << (bool)false
       
   758 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   759     QTest::newRow("ok268") << 200 << 200 << 350 << 0 << 200 << 200
       
   760 			 << (bool)false << (bool)false << (bool)false
       
   761 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   762     QTest::newRow("ok269") << 200 << 200 << 0 << 350 << 200 << 200
       
   763 			 << (bool)false << (bool)true << (bool)false
       
   764 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   765     QTest::newRow("ok270") << 200 << 200 << 0 << 350 << 200 << 200
       
   766 			 << (bool)false << (bool)false << (bool)false
       
   767 			 << (int)QSplitter::Stretch << (int)QSplitter::KeepSize;
       
   768     QTest::newRow("ok280") << 100 << 50 << 100 << 300 << 100 << 300
       
   769 			 << (bool)true << (bool)true << (bool)true
       
   770 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   771     QTest::newRow("ok281") << 100 << 100 << 50 << 350 << 100 << 300
       
   772 			 << (bool)true << (bool)true << (bool)true
       
   773 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   774     QTest::newRow("ok282") << 100 << 100 << 350 << 50 << 300 << 100
       
   775 			 << (bool)true << (bool)true << (bool)true
       
   776 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   777     QTest::newRow("ok283") << 200 << 200 << 350 << 50 << 200 << 200
       
   778 			 << (bool)true << (bool)true << (bool)true
       
   779 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   780     QTest::newRow("ok284") << 200 << 200 << 200 << 200 << 200 << 200
       
   781 			 << (bool)true << (bool)true << (bool)true
       
   782 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   783     QTest::newRow("ok285") << 200 << 200 << 0 << 350 << 0 << 400
       
   784 			 << (bool)true << (bool)true << (bool)true
       
   785 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   786     QTest::newRow("ok286") << 200 << 200 << 350 << 0 << 400 << 0
       
   787 			 << (bool)true << (bool)true << (bool)true
       
   788 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   789     QTest::newRow("ok287") << 200 << 200 << 350 << 0 << 200 << 200
       
   790 			 << (bool)true << (bool)false << (bool)true
       
   791 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   792     QTest::newRow("ok288") << 200 << 200 << 350 << 0 << 200 << 200
       
   793 			 << (bool)false << (bool)false << (bool)true
       
   794 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   795     QTest::newRow("ok289") << 200 << 200 << 0 << 350 << 200 << 200
       
   796 			 << (bool)false << (bool)true << (bool)true
       
   797 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   798     QTest::newRow("ok290") << 200 << 200 << 0 << 350 << 200 << 200
       
   799 			 << (bool)false << (bool)false << (bool)true
       
   800 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   801     QTest::newRow("ok300") << 100 << 50 << 100 << 300 << 100 << 300
       
   802 			 << (bool)true << (bool)true << (bool)false
       
   803 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   804     QTest::newRow("ok301") << 100 << 100 << 50 << 350 << 100 << 300
       
   805 			 << (bool)true << (bool)true << (bool)false
       
   806 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   807     QTest::newRow("ok302") << 100 << 100 << 350 << 50 << 300 << 100
       
   808 			 << (bool)true << (bool)true << (bool)false
       
   809 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   810     QTest::newRow("ok303") << 200 << 200 << 350 << 50 << 200 << 200
       
   811 			 << (bool)true << (bool)true << (bool)false
       
   812 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   813     QTest::newRow("ok304") << 200 << 200 << 200 << 200 << 200 << 200
       
   814 			 << (bool)true << (bool)true << (bool)false
       
   815 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   816     QTest::newRow("ok305") << 200 << 200 << 0 << 350 << 0 << 400
       
   817 			 << (bool)true << (bool)true << (bool)false
       
   818 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   819     QTest::newRow("ok306") << 200 << 200 << 350 << 0 << 400 << 0
       
   820 			 << (bool)true << (bool)true << (bool)false
       
   821 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   822     QTest::newRow("ok307") << 200 << 200 << 350 << 0 << 200 << 200
       
   823 			 << (bool)true << (bool)false << (bool)false
       
   824 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   825     QTest::newRow("ok308") << 200 << 200 << 350 << 0 << 200 << 200
       
   826 			 << (bool)false << (bool)false << (bool)false
       
   827 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   828     QTest::newRow("ok309") << 200 << 200 << 0 << 350 << 200 << 200
       
   829 			 << (bool)false << (bool)true << (bool)false
       
   830 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   831     QTest::newRow("ok310") << 200 << 200 << 0 << 350 << 200 << 200
       
   832 			 << (bool)false << (bool)false << (bool)false
       
   833 			 << (int)QSplitter::KeepSize << (int)QSplitter::Stretch;
       
   834     QTest::newRow("ok320") << 100 << 50 << 100 << 300 << 100 << 300
       
   835 			 << (bool)true << (bool)true << (bool)true
       
   836 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   837     QTest::newRow("ok321") << 100 << 100 << 50 << 350 << 100 << 300
       
   838 			 << (bool)true << (bool)true << (bool)true
       
   839 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   840     QTest::newRow("ok322") << 100 << 100 << 350 << 50 << 300 << 100
       
   841 			 << (bool)true << (bool)true << (bool)true
       
   842 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   843     QTest::newRow("ok323") << 200 << 200 << 350 << 50 << 200 << 200
       
   844 			 << (bool)true << (bool)true << (bool)true
       
   845 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   846     QTest::newRow("ok324") << 200 << 200 << 200 << 200 << 200 << 200
       
   847 			 << (bool)true << (bool)true << (bool)true
       
   848 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   849     QTest::newRow("ok325") << 200 << 200 << 0 << 350 << 0 << 400
       
   850 			 << (bool)true << (bool)true << (bool)true
       
   851 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   852     QTest::newRow("ok326") << 200 << 200 << 350 << 0 << 400 << 0
       
   853 			 << (bool)true << (bool)true << (bool)true
       
   854 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   855     QTest::newRow("ok327") << 200 << 200 << 350 << 0 << 200 << 200
       
   856 			 << (bool)true << (bool)false << (bool)true
       
   857 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   858     QTest::newRow("ok328") << 200 << 200 << 350 << 0 << 200 << 200
       
   859 			 << (bool)false << (bool)false << (bool)true
       
   860 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   861     QTest::newRow("ok329") << 200 << 200 << 0 << 350 << 200 << 200
       
   862 			 << (bool)false << (bool)true << (bool)true
       
   863 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   864     QTest::newRow("ok330") << 200 << 200 << 0 << 350 << 200 << 200
       
   865 			 << (bool)false << (bool)false << (bool)true
       
   866 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   867     QTest::newRow("ok340") << 100 << 50 << 100 << 300 << 100 << 300
       
   868 			 << (bool)true << (bool)true << (bool)false
       
   869 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   870     QTest::newRow("ok341") << 100 << 100 << 50 << 350 << 100 << 300
       
   871 			 << (bool)true << (bool)true << (bool)false
       
   872 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   873     QTest::newRow("ok342") << 100 << 100 << 350 << 50 << 300 << 100
       
   874 			 << (bool)true << (bool)true << (bool)false
       
   875 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   876     QTest::newRow("ok343") << 200 << 200 << 350 << 50 << 200 << 200
       
   877 			 << (bool)true << (bool)true << (bool)false
       
   878 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   879     QTest::newRow("ok344") << 200 << 200 << 200 << 200 << 200 << 200
       
   880 			 << (bool)true << (bool)true << (bool)false
       
   881 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   882     QTest::newRow("ok345") << 200 << 200 << 0 << 350 << 0 << 400
       
   883 			 << (bool)true << (bool)true << (bool)false
       
   884 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   885     QTest::newRow("ok346") << 200 << 200 << 350 << 0 << 400 << 0
       
   886 			 << (bool)true << (bool)true << (bool)false
       
   887 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   888     QTest::newRow("ok347") << 200 << 200 << 350 << 0 << 200 << 200
       
   889 			 << (bool)true << (bool)false << (bool)false
       
   890 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   891     QTest::newRow("ok348") << 200 << 200 << 350 << 0 << 200 << 200
       
   892 			 << (bool)false << (bool)false << (bool)false
       
   893 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   894     QTest::newRow("ok349") << 200 << 200 << 0 << 350 << 200 << 200
       
   895 			 << (bool)false << (bool)true << (bool)false
       
   896 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   897     QTest::newRow("ok350") << 200 << 200 << 0 << 350 << 200 << 200
       
   898 			 << (bool)false << (bool)false << (bool)false
       
   899 			 << (int)QSplitter::KeepSize << (int)QSplitter::KeepSize;
       
   900 #endif
       
   901 }
       
   902 
       
   903 void tst_QSplitter::saveAndRestoreState_data()
       
   904 {
       
   905     saveState_data();
       
   906 }
       
   907 
       
   908 void tst_QSplitter::saveAndRestoreState()
       
   909 {
       
   910     QFETCH(IntList, initialSizes);
       
   911     splitter->setSizes(initialSizes);
       
   912     QApplication::instance()->sendPostedEvents();
       
   913     
       
   914     QSplitter *splitter2 = new QSplitter(splitter->orientation() == Qt::Horizontal ?
       
   915                                          Qt::Vertical : Qt::Horizontal);
       
   916     for (int i = 0; i < splitter->count(); ++i) {
       
   917         splitter2->addWidget(new QWidget());        
       
   918     }
       
   919     splitter2->resize(splitter->size());    
       
   920     splitter2->setChildrenCollapsible(!splitter->childrenCollapsible());
       
   921     splitter2->setOpaqueResize(!splitter->opaqueResize());
       
   922     splitter2->setHandleWidth(splitter->handleWidth()+3);
       
   923     
       
   924     QByteArray ba = splitter->saveState();
       
   925     QVERIFY(splitter2->restoreState(ba));
       
   926 
       
   927     QCOMPARE(splitter2->orientation(), splitter->orientation());
       
   928     QCOMPARE(splitter2->handleWidth(), splitter->handleWidth());
       
   929     QCOMPARE(splitter2->opaqueResize(), splitter->opaqueResize());
       
   930     QCOMPARE(splitter2->childrenCollapsible(), splitter->childrenCollapsible());
       
   931 
       
   932     QList<int> l1 = splitter->sizes();
       
   933     QList<int> l2 = splitter2->sizes();
       
   934     QCOMPARE(l1.size(), l2.size());
       
   935     for (int i = 0; i < splitter->sizes().size(); ++i) {
       
   936         QCOMPARE(l2.at(i), l1.at(i));
       
   937     }
       
   938 
       
   939     // destroy version and magic number
       
   940     for (int i = 0; i < ba.size(); ++i) 
       
   941         ba[i] = ~ba.at(i);
       
   942     QVERIFY(!splitter2->restoreState(ba));
       
   943     
       
   944     delete splitter2;
       
   945 }
       
   946 
       
   947 void tst_QSplitter::saveAndRestoreStateOfNotYetShownSplitter()
       
   948 {
       
   949     QSplitter *spl = new QSplitter;
       
   950     QLabel *l1 = new QLabel;
       
   951     QLabel *l2 = new QLabel;
       
   952     spl->addWidget(l1);
       
   953     spl->addWidget(l2);
       
   954 
       
   955     QByteArray ba = spl->saveState();
       
   956     spl->restoreState(ba);
       
   957     spl->show();
       
   958     QTest::qWait(500);
       
   959 
       
   960     QCOMPARE(l1->geometry().isValid(), true);
       
   961     QCOMPARE(l2->geometry().isValid(), true);
       
   962 
       
   963     delete spl;
       
   964 }
       
   965 
       
   966 void tst_QSplitter::saveState_data()
       
   967 {
       
   968     QTest::addColumn<IntList>("initialSizes");
       
   969     QTest::addColumn<bool>("hideWidget1");
       
   970     QTest::addColumn<bool>("hideWidget2");
       
   971     QTest::addColumn<QByteArray>("finalBa");
       
   972 
       
   973     QTest::newRow("ok0") << (IntList() << 200 << 200) << bool(false) << bool(false) << QByteArray("[200,200]");
       
   974     QTest::newRow("ok1") << (IntList() << 300 << 100) << bool(false) << bool(false) << QByteArray("[300,100]");
       
   975     QTest::newRow("ok2") << (IntList() << 100 << 300) << bool(false) << bool(false) << QByteArray("[100,300]");
       
   976     QTest::newRow("ok3") << (IntList() << 200 << 200) << bool(false) << bool(true) << QByteArray("[200,H]");
       
   977     QTest::newRow("ok4") << (IntList() << 200 << 200) << bool(true) << bool(false) << QByteArray("[H,200]");
       
   978     QTest::newRow("ok5") << (IntList() << 200 << 200) << bool(false) << bool(false) << QByteArray("[200,200]");
       
   979     QTest::newRow("ok6") << (IntList() << 200 << 200) << bool(false) << bool(false) << QByteArray("[200,200]");
       
   980     QTest::newRow("ok7") << (IntList() << 200 << 200) << bool(false) << bool(false) << QByteArray("[200,200]");
       
   981     QTest::newRow("ok8") << (IntList() << 200 << 200) << bool(true) << bool(true) << QByteArray("[H,H]");
       
   982 }
       
   983 
       
   984 void tst_QSplitter::addWidget()
       
   985 {
       
   986     QSplitter split;
       
   987 
       
   988     // Simple case
       
   989     QWidget *widget1 = new QWidget;
       
   990     QWidget *widget2 = new QWidget;
       
   991     split.addWidget(widget1);
       
   992     split.addWidget(widget2);
       
   993     QCOMPARE(split.count(), 2);
       
   994     QCOMPARE(split.indexOf(widget1), 0);
       
   995     QCOMPARE(split.indexOf(widget2), 1);
       
   996     QCOMPARE(split.widget(0), widget1);
       
   997     QCOMPARE(split.widget(1), widget2);
       
   998 
       
   999 
       
  1000     // Implicit Add
       
  1001     QWidget *widget3 = new QWidget(&split);
       
  1002     QCOMPARE(split.count(), 3);
       
  1003     QCOMPARE(split.indexOf(widget3), 2);
       
  1004     QCOMPARE(split.widget(2), widget3);
       
  1005 
       
  1006     // Try and add it again
       
  1007     split.addWidget(widget3);
       
  1008     QCOMPARE(split.count(), 3);
       
  1009     QCOMPARE(split.indexOf(widget3), 2);
       
  1010     QCOMPARE(split.widget(2), widget3);
       
  1011 
       
  1012     // Add a widget that is already in the splitter
       
  1013     split.addWidget(widget1);
       
  1014     QCOMPARE(split.count(), 3);
       
  1015     QCOMPARE(split.indexOf(widget1), 2);
       
  1016     QCOMPARE(split.widget(0), widget2);
       
  1017     QCOMPARE(split.widget(1), widget3);
       
  1018     QCOMPARE(split.widget(2), widget1);
       
  1019 
       
  1020     // Change a widget's parent
       
  1021     widget2->setParent(0);
       
  1022     QCOMPARE(split.count(), 2);
       
  1023     QCOMPARE(split.indexOf(widget2), -1);
       
  1024 
       
  1025 
       
  1026     // Add the widget in again.
       
  1027     split.addWidget(widget2);
       
  1028     QCOMPARE(split.count(), 3);
       
  1029     QCOMPARE(split.indexOf(widget2), 2);
       
  1030     QCOMPARE(split.widget(0), widget3);
       
  1031     QCOMPARE(split.widget(1), widget1);
       
  1032     QCOMPARE(split.widget(2), widget2);
       
  1033 
       
  1034     // Delete a widget
       
  1035     delete widget1;
       
  1036     QCOMPARE(split.count(), 2);
       
  1037     QCOMPARE(split.indexOf(widget1), -1); // Nasty
       
  1038     QCOMPARE(split.widget(0), widget3);
       
  1039     QCOMPARE(split.widget(1), widget2);
       
  1040 
       
  1041     delete widget2;
       
  1042 }
       
  1043 
       
  1044 void tst_QSplitter::insertWidget()
       
  1045 {
       
  1046     QSplitter split;
       
  1047     QWidget *widget1 = new QWidget;
       
  1048     QWidget *widget2 = new QWidget;
       
  1049     QWidget *widget3 = new QWidget;
       
  1050 
       
  1051     split.insertWidget(0, widget1);
       
  1052     QCOMPARE(split.count(), 1);
       
  1053     QCOMPARE(split.indexOf(widget1), 0);
       
  1054     QCOMPARE(split.widget(0), widget1);
       
  1055 
       
  1056     split.insertWidget(0, widget2);
       
  1057     QCOMPARE(split.count(), 2);
       
  1058     QCOMPARE(split.indexOf(widget1), 1);
       
  1059     QCOMPARE(split.indexOf(widget2), 0);
       
  1060     QCOMPARE(split.widget(0), widget2);
       
  1061     QCOMPARE(split.widget(1), widget1);
       
  1062 
       
  1063     split.insertWidget(1, widget3);
       
  1064     QCOMPARE(split.count(), 3);
       
  1065     QCOMPARE(split.indexOf(widget1), 2);
       
  1066     QCOMPARE(split.indexOf(widget2), 0);
       
  1067     QCOMPARE(split.indexOf(widget3), 1);
       
  1068     QCOMPARE(split.widget(0), widget2);
       
  1069     QCOMPARE(split.widget(1), widget3);
       
  1070     QCOMPARE(split.widget(2), widget1);
       
  1071 
       
  1072     delete widget3;
       
  1073     QCOMPARE(split.count(), 2);
       
  1074     QCOMPARE(split.indexOf(widget1), 1);
       
  1075     QCOMPARE(split.indexOf(widget2), 0);
       
  1076     QCOMPARE(split.widget(0), widget2);
       
  1077     QCOMPARE(split.widget(1), widget1);
       
  1078 
       
  1079     widget3 = new QWidget;
       
  1080     split.insertWidget(split.count() + 1, widget3);
       
  1081     QCOMPARE(split.count(), 3);
       
  1082     QCOMPARE(split.indexOf(widget1), 1);
       
  1083     QCOMPARE(split.indexOf(widget2), 0);
       
  1084     QCOMPARE(split.indexOf(widget3), 2);
       
  1085     QCOMPARE(split.widget(0), widget2);
       
  1086     QCOMPARE(split.widget(1), widget1);
       
  1087     QCOMPARE(split.widget(2), widget3);
       
  1088 
       
  1089 
       
  1090     // Try it again,
       
  1091     split.insertWidget(split.count() + 1, widget3);
       
  1092     QCOMPARE(split.count(), 3);
       
  1093     QCOMPARE(split.indexOf(widget1), 1);
       
  1094     QCOMPARE(split.indexOf(widget2), 0);
       
  1095     QCOMPARE(split.indexOf(widget3), 2);
       
  1096     QCOMPARE(split.widget(0), widget2);
       
  1097     QCOMPARE(split.widget(1), widget1);
       
  1098     QCOMPARE(split.widget(2), widget3);
       
  1099 
       
  1100     // Try to move widget2 to a bad place
       
  1101     split.insertWidget(-1, widget2);
       
  1102     QCOMPARE(split.count(), 3);
       
  1103     QCOMPARE(split.indexOf(widget1), 0);
       
  1104     QCOMPARE(split.indexOf(widget2), 2);
       
  1105     QCOMPARE(split.indexOf(widget3), 1);
       
  1106     QCOMPARE(split.widget(0), widget1);
       
  1107     QCOMPARE(split.widget(1), widget3);
       
  1108     QCOMPARE(split.widget(2), widget2);
       
  1109 
       
  1110     QWidget *widget4 = new QWidget(&split);
       
  1111     QCOMPARE(split.count(), 4);
       
  1112     QCOMPARE(split.indexOf(widget1), 0);
       
  1113     QCOMPARE(split.indexOf(widget2), 2);
       
  1114     QCOMPARE(split.indexOf(widget3), 1);
       
  1115     QCOMPARE(split.indexOf(widget4), 3);
       
  1116     QCOMPARE(split.widget(0), widget1);
       
  1117     QCOMPARE(split.widget(1), widget3);
       
  1118     QCOMPARE(split.widget(2), widget2);
       
  1119     QCOMPARE(split.widget(3), widget4);
       
  1120 
       
  1121     QWidget *widget5 = new QWidget(&split);
       
  1122     QCOMPARE(split.count(), 5);
       
  1123     QCOMPARE(split.indexOf(widget1), 0);
       
  1124     QCOMPARE(split.indexOf(widget2), 2);
       
  1125     QCOMPARE(split.indexOf(widget3), 1);
       
  1126     QCOMPARE(split.indexOf(widget4), 3);
       
  1127     QCOMPARE(split.indexOf(widget5), 4);
       
  1128     QCOMPARE(split.widget(0), widget1);
       
  1129     QCOMPARE(split.widget(1), widget3);
       
  1130     QCOMPARE(split.widget(2), widget2);
       
  1131     QCOMPARE(split.widget(3), widget4);
       
  1132     QCOMPARE(split.widget(4), widget5);
       
  1133 
       
  1134     split.insertWidget(2, widget4);
       
  1135     QCOMPARE(split.count(), 5);
       
  1136     QCOMPARE(split.indexOf(widget1), 0);
       
  1137     QCOMPARE(split.indexOf(widget2), 3);
       
  1138     QCOMPARE(split.indexOf(widget3), 1);
       
  1139     QCOMPARE(split.indexOf(widget4), 2);
       
  1140     QCOMPARE(split.indexOf(widget5), 4);
       
  1141     QCOMPARE(split.widget(0), widget1);
       
  1142     QCOMPARE(split.widget(1), widget3);
       
  1143     QCOMPARE(split.widget(2), widget4);
       
  1144     QCOMPARE(split.widget(3), widget2);
       
  1145     QCOMPARE(split.widget(4), widget5);
       
  1146 
       
  1147     split.insertWidget(1, widget5);
       
  1148     QCOMPARE(split.count(), 5);
       
  1149     QCOMPARE(split.indexOf(widget1), 0);
       
  1150     QCOMPARE(split.indexOf(widget2), 4);
       
  1151     QCOMPARE(split.indexOf(widget3), 2);
       
  1152     QCOMPARE(split.indexOf(widget4), 3);
       
  1153     QCOMPARE(split.indexOf(widget5), 1);
       
  1154     QCOMPARE(split.widget(0), widget1);
       
  1155     QCOMPARE(split.widget(1), widget5);
       
  1156     QCOMPARE(split.widget(2), widget3);
       
  1157     QCOMPARE(split.widget(3), widget4);
       
  1158     QCOMPARE(split.widget(4), widget2);
       
  1159 }
       
  1160 
       
  1161 void tst_QSplitter::setStretchFactor_data()
       
  1162 {
       
  1163     QTest::addColumn<int>("orientation");
       
  1164     QTest::addColumn<int>("widgetIndex");
       
  1165     QTest::addColumn<int>("stretchFactor");
       
  1166     QTest::addColumn<int>("expectedHStretch");
       
  1167     QTest::addColumn<int>("expectedVStretch");
       
  1168 
       
  1169     QTest::newRow("ok01") << int(Qt::Horizontal) << 1 << 2 << 2 << 2;
       
  1170     QTest::newRow("ok02") << int(Qt::Horizontal) << 2 << 0 << 0 << 0;
       
  1171     QTest::newRow("ok03") << int(Qt::Horizontal) << 3 << 1 << 1 << 1;
       
  1172     QTest::newRow("ok04") << int(Qt::Horizontal) << 0 << 7 << 7 << 7;
       
  1173     QTest::newRow("ok05") << int(Qt::Vertical) << 0 << 0 << 0 << 0;
       
  1174     QTest::newRow("ok06") << int(Qt::Vertical) << 1 << 1 << 1 << 1;
       
  1175     QTest::newRow("ok07") << int(Qt::Vertical) << 2 << 2 << 2 << 2;
       
  1176     QTest::newRow("ok08") << int(Qt::Vertical) << 3 << 5 << 5 << 5;
       
  1177     QTest::newRow("ok08") << int(Qt::Vertical) << -1 << 5 << 0 << 0;
       
  1178 }
       
  1179 
       
  1180 void tst_QSplitter::setStretchFactor()
       
  1181 {
       
  1182     QFETCH(int, orientation);
       
  1183     Qt::Orientation orient = Qt::Orientation(orientation);
       
  1184     QSplitter split(orient);
       
  1185     QWidget *w = new QWidget;
       
  1186     split.addWidget(w);
       
  1187     w = new QWidget;
       
  1188     split.addWidget(w);
       
  1189     w = new QWidget;
       
  1190     split.addWidget(w);
       
  1191     w = new QWidget;
       
  1192     split.addWidget(w);
       
  1193 
       
  1194     QFETCH(int, widgetIndex);
       
  1195     QFETCH(int, stretchFactor);
       
  1196     w = split.widget(widgetIndex);
       
  1197     QSizePolicy sp;
       
  1198     if (w) {
       
  1199         QCOMPARE(sp.horizontalStretch(), 0);
       
  1200         QCOMPARE(sp.verticalStretch(), 0);
       
  1201     }
       
  1202     split.setStretchFactor(widgetIndex, stretchFactor);
       
  1203     if (w)
       
  1204         sp = w->sizePolicy();
       
  1205     QTEST(sp.horizontalStretch(), "expectedHStretch");
       
  1206     QTEST(sp.verticalStretch(), "expectedVStretch");
       
  1207 }
       
  1208 
       
  1209 void tst_QSplitter::testShowHide_data()
       
  1210 {
       
  1211     QTest::addColumn<bool>("hideWidget1");
       
  1212     QTest::addColumn<bool>("hideWidget2");
       
  1213     QTest::addColumn<QList<int> >("finalValues");
       
  1214     QTest::addColumn<bool>("handleVisible");
       
  1215 
       
  1216     QSplitter *split = new QSplitter(Qt::Horizontal);
       
  1217     QTest::newRow("hideNone") << false << false << (QList<int>() << 200 << 200) << true;
       
  1218     QTest::newRow("hide2") << false << true << (QList<int>() << 400 + split->handleWidth() << 0) << false;
       
  1219     QTest::newRow("hide1") << true << false << (QList<int>() << 0 << 400 + split->handleWidth()) << false;
       
  1220     QTest::newRow("hideall") << true << true << (QList<int>() << 0 << 0) << false;
       
  1221     delete split;
       
  1222 }
       
  1223 
       
  1224 void tst_QSplitter::testShowHide()
       
  1225 {
       
  1226     QFETCH(bool, hideWidget1);
       
  1227     QFETCH(bool, hideWidget2);
       
  1228 
       
  1229     QSplitter *split = new QSplitter(Qt::Horizontal);
       
  1230 
       
  1231     QWidget widget;
       
  1232     widget.resize(400 + split->handleWidth(), 200);
       
  1233     QVBoxLayout *lay=new QVBoxLayout(&widget);
       
  1234     lay->setMargin(0);
       
  1235     lay->setSpacing(0);
       
  1236     split->addWidget(new QWidget);
       
  1237     split->addWidget(new QWidget);
       
  1238     split->setSizes(QList<int>() << 200 << 200);
       
  1239     lay->addWidget(split);
       
  1240     widget.setLayout(lay);
       
  1241     widget.show();
       
  1242 
       
  1243     QTest::qWait(100);
       
  1244 
       
  1245     widget.hide();
       
  1246     split->widget(0)->setHidden(hideWidget1);
       
  1247     split->widget(1)->setHidden(hideWidget2);
       
  1248     widget.show();
       
  1249     QTest::qWait(100);
       
  1250 
       
  1251     QTEST(split->sizes(), "finalValues");
       
  1252     QTEST(split->handle(1)->isVisible(), "handleVisible");
       
  1253 }
       
  1254 
       
  1255 void tst_QSplitter::testRemoval()
       
  1256 {
       
  1257 
       
  1258     // This test relies on the internal structure of QSplitter That is, that
       
  1259     // there is a handle before every splitter, but sometimes that handle is
       
  1260     // hidden. But definiately when something is removed the front handle
       
  1261     // should not be visible.
       
  1262 
       
  1263     QSplitter split;
       
  1264     split.addWidget(new QWidget);
       
  1265     split.addWidget(new QWidget);
       
  1266     split.show();
       
  1267     QTest::qWait(100);
       
  1268 
       
  1269     QCOMPARE(split.handle(0)->isVisible(), false);
       
  1270     QSplitterHandle *handle = split.handle(1);
       
  1271     QCOMPARE(handle->isVisible(), true);
       
  1272 
       
  1273     delete split.widget(0);
       
  1274     QSplitterHandle *sameHandle = split.handle(0);
       
  1275     QCOMPARE(handle, sameHandle);
       
  1276     QCOMPARE(sameHandle->isVisible(), false);
       
  1277 }
       
  1278 
       
  1279 class MyFriendlySplitter : public QSplitter
       
  1280 {
       
  1281 public:
       
  1282     MyFriendlySplitter(QWidget *parent = 0) : QSplitter(parent) {}
       
  1283     void setRubberBand(int pos) { QSplitter::setRubberBand(pos); }
       
  1284 };
       
  1285 
       
  1286 void tst_QSplitter::rubberBandNotInSplitter()
       
  1287 {
       
  1288     MyFriendlySplitter split;
       
  1289     split.addWidget(new QWidget);
       
  1290     split.addWidget(new QWidget);
       
  1291     split.setOpaqueResize(false);
       
  1292     QCOMPARE(split.count(), 2);
       
  1293     split.setRubberBand(2);
       
  1294     QCOMPARE(split.count(), 2);
       
  1295 }
       
  1296 
       
  1297 void tst_QSplitter::task187373_addAbstractScrollAreas_data()
       
  1298 {
       
  1299     QTest::addColumn<QString>("className");
       
  1300     QTest::addColumn<bool>("addInConstructor");
       
  1301     QTest::addColumn<bool>("addOutsideConstructor");
       
  1302 
       
  1303     QStringList classNames;
       
  1304     classNames << QLatin1String("QGraphicsView");
       
  1305     classNames << QLatin1String("QMdiArea");
       
  1306     classNames << QLatin1String("QScrollArea");
       
  1307     classNames << QLatin1String("QTextEdit");
       
  1308     classNames << QLatin1String("QTreeView");
       
  1309 
       
  1310     foreach (QString className, classNames) {
       
  1311         QTest::newRow(qPrintable(QString("%1 1").arg(className))) << className << false << true;
       
  1312         QTest::newRow(qPrintable(QString("%1 2").arg(className))) << className << true << false;
       
  1313         QTest::newRow(qPrintable(QString("%1 3").arg(className))) << className << true << true;
       
  1314     }
       
  1315 }
       
  1316 
       
  1317 static QAbstractScrollArea *task187373_createScrollArea(
       
  1318     QSplitter *splitter, const QString &className, bool addInConstructor)
       
  1319 {
       
  1320     if (className == QLatin1String("QGraphicsView"))
       
  1321         return new QGraphicsView(addInConstructor ? splitter : 0);
       
  1322     if (className == QLatin1String("QMdiArea"))
       
  1323         return new QMdiArea(addInConstructor ? splitter : 0);
       
  1324     if (className == QLatin1String("QScrollArea"))
       
  1325         return new QScrollArea(addInConstructor ? splitter : 0);
       
  1326     if (className == QLatin1String("QTextEdit"))
       
  1327         return new QTextEdit(addInConstructor ? splitter : 0);
       
  1328     if (className == QLatin1String("QTreeView"))
       
  1329         return new QTreeView(addInConstructor ? splitter : 0);
       
  1330     return 0;
       
  1331 }
       
  1332 
       
  1333 void tst_QSplitter::task187373_addAbstractScrollAreas()
       
  1334 {
       
  1335     QFETCH(QString, className);
       
  1336     QFETCH(bool, addInConstructor);
       
  1337     QFETCH(bool, addOutsideConstructor);
       
  1338     Q_ASSERT(addInConstructor || addOutsideConstructor);
       
  1339 
       
  1340     QSplitter *splitter = new QSplitter;
       
  1341     splitter->show();
       
  1342     Q_ASSERT(splitter->isVisible());
       
  1343 
       
  1344     QAbstractScrollArea *w = task187373_createScrollArea(splitter, className, addInConstructor);
       
  1345     Q_ASSERT(w);
       
  1346     if (addOutsideConstructor)
       
  1347         splitter->addWidget(w);
       
  1348 
       
  1349     QTRY_VERIFY(w->isVisible());
       
  1350     QVERIFY(!w->isHidden());
       
  1351     QVERIFY(w->viewport()->isVisible());
       
  1352     QVERIFY(!w->viewport()->isHidden());
       
  1353 }
       
  1354 
       
  1355 //! A simple QTextEdit which can switch between two different size states
       
  1356 class MyTextEdit : public QTextEdit 
       
  1357 {
       
  1358     public:
       
  1359         MyTextEdit(const QString & text, QWidget* parent = NULL)
       
  1360             : QTextEdit(text, parent) ,  m_iFactor(1)
       
  1361         {
       
  1362             setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
       
  1363         }
       
  1364         virtual QSize minimumSizeHint () const
       
  1365         {
       
  1366             return QSize(200, 200) * m_iFactor;
       
  1367         }
       
  1368         virtual QSize sizeHint() const
       
  1369         {
       
  1370             return QSize(390, 390) * m_iFactor;
       
  1371         }
       
  1372         int m_iFactor;
       
  1373 };
       
  1374 
       
  1375 void tst_QSplitter::task169702_sizes()
       
  1376 {
       
  1377     // Create two nested (non-collapsible) splitters
       
  1378     QSplitter* outerSplitter = new QSplitter(Qt::Vertical);
       
  1379     outerSplitter->setChildrenCollapsible(false);
       
  1380     QSplitter* splitter = new QSplitter(Qt::Horizontal, outerSplitter);
       
  1381     splitter->setChildrenCollapsible(false);
       
  1382 
       
  1383     // populate the outer splitter
       
  1384     outerSplitter->addWidget(new QTextEdit("Foo"));
       
  1385     outerSplitter->addWidget(splitter);
       
  1386     outerSplitter->setStretchFactor(0, 1);
       
  1387     outerSplitter->setStretchFactor(1, 0);
       
  1388 
       
  1389     // populate the inner splitter
       
  1390     MyTextEdit* testW = new MyTextEdit("TextEdit with size restriction");
       
  1391     splitter->addWidget(testW);
       
  1392     splitter->addWidget(new QTextEdit("Bar"));
       
  1393 
       
  1394     outerSplitter->setGeometry(100, 100, 500, 500);
       
  1395     outerSplitter->show();
       
  1396 
       
  1397     QTest::qWait(100);
       
  1398     testW->m_iFactor++;
       
  1399     testW->updateGeometry();
       
  1400     QTest::qWait(100);
       
  1401 
       
  1402     //Make sure the minimimSizeHint is respected
       
  1403     QCOMPARE(testW->size().height(), testW->minimumSizeHint().height());
       
  1404 }
       
  1405 
       
  1406 QTEST_MAIN(tst_QSplitter)
       
  1407 #include "tst_qsplitter.moc"