summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Tapsell <john.tapsell.ext@basyskom.de>2010-10-08 14:10:20 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-10-13 11:32:19 (GMT)
commitfcda1b785bd7d86011f49bfe96cb22b04202933f (patch)
tree5adaeba24330f730e86550fac0d8f58de9a598fa /tests
parent6d4d265e7e67dde58e45d7d89f4974d0bd8b70e4 (diff)
downloadQt-fcda1b785bd7d86011f49bfe96cb22b04202933f.zip
Qt-fcda1b785bd7d86011f49bfe96cb22b04202933f.tar.gz
Qt-fcda1b785bd7d86011f49bfe96cb22b04202933f.tar.bz2
QGraphicsLayoutItem - user set sizes should always override, even if there's a constraint
Notes: * I have had to remove some of the old unit tests because the tested for strange behaviour. Now that height for width items behave more like normal items, it's no longer so easy to calculate what the geometries should be in strangely-sized layouts. * This also fixes alignment of height-for-width objects and adds a unit test for this. This couldn't be done in a seperate commit since the two fixes are related. Merge-request: 847 Reviewed-by: Olivier Goffart
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp333
1 files changed, 177 insertions, 156 deletions
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 3827018..174e4aa 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -61,13 +61,19 @@ private slots:
void qgraphicsgridlayout();
void addItem_data();
void addItem();
+ void alignment_data();
void alignment();
void alignment2();
void alignment2_data();
+ void columnAlignment_data();
void columnAlignment();
+ void columnCount_data();
void columnCount();
+ void columnMaximumWidth_data();
void columnMaximumWidth();
+ void columnMinimumWidth_data();
void columnMinimumWidth();
+ void columnPreferredWidth_data();
void columnPreferredWidth();
void setColumnFixedWidth();
void columnSpacing();
@@ -78,12 +84,18 @@ private slots:
void horizontalSpacing();
void itemAt();
void removeAt();
+ void rowAlignment_data();
void rowAlignment();
+ void rowCount_data();
void rowCount();
+ void rowMaximumHeight_data();
void rowMaximumHeight();
+ void rowMinimumHeight_data();
void rowMinimumHeight();
+ void rowPreferredHeight_data();
void rowPreferredHeight();
void rowSpacing();
+ void rowStretchFactor_data();
void rowStretchFactor();
void setColumnSpacing_data();
void setColumnSpacing();
@@ -98,6 +110,7 @@ private slots:
void sizeHint();
void verticalSpacing_data();
void verticalSpacing();
+ void layoutDirection_data();
void layoutDirection();
void removeLayout();
void defaultStretchFactors_data();
@@ -371,7 +384,7 @@ void tst_QGraphicsGridLayout::qgraphicsgridlayout()
layout.verticalSpacing();
}
-static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int height)
+static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int height, bool hasHeightForWidth = false)
{
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
@@ -380,6 +393,9 @@ static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int heigh
item->setPreferredSize(25, 25);
item->setMaximumSize(50, 50);
gridLayout->addItem(item, y, x);
+ QSizePolicy policy = item->sizePolicy();
+ policy.setHeightForWidth(hasHeightForWidth);
+ item->setSizePolicy(policy);
}
}
}
@@ -396,18 +412,22 @@ static void populateLayout(QGraphicsGridLayout *gridLayout, int width, int heigh
* |xxxx|+---|---+|
* +----+----+----+
*/
-static void populateLayoutWithSpansAndHoles(QGraphicsGridLayout *gridLayout)
+static void populateLayoutWithSpansAndHoles(QGraphicsGridLayout *gridLayout, bool hasHeightForWidth = false)
{
QGraphicsWidget *item = new RectWidget();
item->setMinimumSize(10, 10);
item->setPreferredSize(25, 25);
item->setMaximumSize(50, 50);
+ QSizePolicy sizepolicy = item->sizePolicy();
+ sizepolicy.setHeightForWidth(hasHeightForWidth);
+ item->setSizePolicy(sizepolicy);
gridLayout->addItem(item, 0, 0, 1, 2);
item = new RectWidget();
item->setMinimumSize(10, 10);
item->setPreferredSize(25, 25);
item->setMaximumSize(50, 50);
+ item->setSizePolicy(sizepolicy);
gridLayout->addItem(item, 1, 1, 1, 2);
}
@@ -460,19 +480,28 @@ void tst_QGraphicsGridLayout::addItem()
delete layout;
}
+void tst_QGraphicsGridLayout::alignment_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
+
// public Qt::Alignment alignment(QGraphicsLayoutItem* item) const
void tst_QGraphicsGridLayout::alignment()
{
#ifdef Q_WS_MAC
QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac", SkipAll);
#endif
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -524,6 +553,14 @@ void tst_QGraphicsGridLayout::alignment()
delete widget;
}
+void tst_QGraphicsGridLayout::columnAlignment_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
+
// public void setColumnAlignment(int column, Qt::Alignment alignment)
// public Qt::Alignment columnAlignment(int column) const
void tst_QGraphicsGridLayout::columnAlignment()
@@ -531,13 +568,14 @@ void tst_QGraphicsGridLayout::columnAlignment()
#ifdef Q_WS_MAC
QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac", SkipAll);
#endif
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(1);
widget->setContentsMargins(0, 0, 0, 0);
@@ -583,9 +621,17 @@ void tst_QGraphicsGridLayout::columnAlignment()
delete widget;
}
+void tst_QGraphicsGridLayout::columnCount_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
// public int columnCount() const
void tst_QGraphicsGridLayout::columnCount()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
@@ -617,7 +663,7 @@ void tst_QGraphicsGridLayout::columnCount()
// ### Talk with Jasmin. Not sure if removeAt() should adjust columnCount().
widget->setLayout(0);
layout = new QGraphicsGridLayout();
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
QCOMPARE(layout->columnCount(), 3);
layout->removeAt(5);
layout->removeAt(3);
@@ -632,16 +678,24 @@ void tst_QGraphicsGridLayout::columnCount()
delete widget;
}
+void tst_QGraphicsGridLayout::columnMaximumWidth_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
// public qreal columnMaximumWidth(int column) const
void tst_QGraphicsGridLayout::columnMaximumWidth()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -667,16 +721,24 @@ void tst_QGraphicsGridLayout::columnMaximumWidth()
delete widget;
}
+void tst_QGraphicsGridLayout::columnMinimumWidth_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
// public qreal columnMinimumWidth(int column) const
void tst_QGraphicsGridLayout::columnMinimumWidth()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -702,16 +764,24 @@ void tst_QGraphicsGridLayout::columnMinimumWidth()
delete widget;
}
+void tst_QGraphicsGridLayout::columnPreferredWidth_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
// public qreal columnPreferredWidth(int column) const
void tst_QGraphicsGridLayout::columnPreferredWidth()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -1021,16 +1091,25 @@ void tst_QGraphicsGridLayout::removeAt()
delete widget;
}
+void tst_QGraphicsGridLayout::rowAlignment_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
+
// public Qt::Alignment rowAlignment(int row) const
void tst_QGraphicsGridLayout::rowAlignment()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 2, 3);
+ populateLayout(layout, 2, 3, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(1);
widget->setContentsMargins(0, 0, 0, 0);
@@ -1080,17 +1159,26 @@ void tst_QGraphicsGridLayout::rowAlignment()
delete widget;
}
+void tst_QGraphicsGridLayout::rowCount_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
+
// public int rowCount() const
// public int columnCount() const
void tst_QGraphicsGridLayout::rowCount()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 2, 3);
+ populateLayout(layout, 2, 3, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
widget->setContentsMargins(0, 0, 0, 0);
@@ -1100,23 +1188,32 @@ void tst_QGraphicsGridLayout::rowCount()
// with spans and holes...
widget->setLayout(0);
layout = new QGraphicsGridLayout();
- populateLayoutWithSpansAndHoles(layout);
+ populateLayoutWithSpansAndHoles(layout, hasHeightForWidth);
QCOMPARE(layout->rowCount(), 2);
QCOMPARE(layout->columnCount(), 3);
delete widget;
}
+void tst_QGraphicsGridLayout::rowMaximumHeight_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
+
// public qreal rowMaximumHeight(int row) const
void tst_QGraphicsGridLayout::rowMaximumHeight()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 2, 3);
+ populateLayout(layout, 2, 3, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -1142,16 +1239,24 @@ void tst_QGraphicsGridLayout::rowMaximumHeight()
delete widget;
}
+void tst_QGraphicsGridLayout::rowMinimumHeight_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
// public qreal rowMinimumHeight(int row) const
void tst_QGraphicsGridLayout::rowMinimumHeight()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 2, 3);
+ populateLayout(layout, 2, 3, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -1177,16 +1282,24 @@ void tst_QGraphicsGridLayout::rowMinimumHeight()
delete widget;
}
+void tst_QGraphicsGridLayout::rowPreferredHeight_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
// public qreal rowPreferredHeight(int row) const
void tst_QGraphicsGridLayout::rowPreferredHeight()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 2, 3);
+ populateLayout(layout, 2, 3, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -1275,16 +1388,25 @@ void tst_QGraphicsGridLayout::rowSpacing()
}
+void tst_QGraphicsGridLayout::rowStretchFactor_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
+
// public int rowStretchFactor(int row) const
void tst_QGraphicsGridLayout::rowStretchFactor()
{
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 2, 3);
+ populateLayout(layout, 2, 3, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
@@ -1308,9 +1430,12 @@ void tst_QGraphicsGridLayout::setColumnSpacing_data()
{
QTest::addColumn<int>("column");
QTest::addColumn<qreal>("spacing");
- QTest::newRow("null") << 0 << qreal(0.0);
- QTest::newRow("10") << 0 << qreal(10.0);
+ QTest::addColumn<bool>("hasHeightForWidth");
+ QTest::newRow("null") << 0 << qreal(0.0) << false;
+ QTest::newRow("10") << 0 << qreal(10.0) << false;
+ QTest::newRow("null, hasHeightForWidth") << 0 << qreal(0.0) << true;
+ QTest::newRow("10, hasHeightForWidth") << 0 << qreal(10.0) << true;
}
// public void setColumnSpacing(int column, qreal spacing)
@@ -1318,6 +1443,7 @@ void tst_QGraphicsGridLayout::setColumnSpacing()
{
QFETCH(int, column);
QFETCH(qreal, spacing);
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -1325,7 +1451,7 @@ void tst_QGraphicsGridLayout::setColumnSpacing()
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
qreal oldSpacing = layout->columnSpacing(column);
@@ -1362,9 +1488,12 @@ void tst_QGraphicsGridLayout::setRowSpacing_data()
{
QTest::addColumn<int>("row");
QTest::addColumn<qreal>("spacing");
- QTest::newRow("null") << 0 << qreal(0.0);
- QTest::newRow("10") << 0 << qreal(10.0);
+ QTest::addColumn<bool>("hasHeightForWidth");
+ QTest::newRow("null") << 0 << qreal(0.0) << false;
+ QTest::newRow("10") << 0 << qreal(10.0) << false;
+ QTest::newRow("null, hasHeightForWidth") << 0 << qreal(0.0) << true;
+ QTest::newRow("10, hasHeightForWidth") << 0 << qreal(10.0) << true;
}
// public void setRowSpacing(int row, qreal spacing)
@@ -1372,6 +1501,7 @@ void tst_QGraphicsGridLayout::setRowSpacing()
{
QFETCH(int, row);
QFETCH(qreal, spacing);
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -1379,7 +1509,7 @@ void tst_QGraphicsGridLayout::setRowSpacing()
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
qreal oldSpacing = layout->rowSpacing(row);
@@ -1393,21 +1523,25 @@ void tst_QGraphicsGridLayout::setRowSpacing()
void tst_QGraphicsGridLayout::setSpacing_data()
{
QTest::addColumn<qreal>("spacing");
- QTest::newRow("zero") << qreal(0.0);
- QTest::newRow("17") << qreal(17.0);
+ QTest::addColumn<bool>("hasHeightForWidth");
+ QTest::newRow("zero") << qreal(0.0) << false;
+ QTest::newRow("17") << qreal(17.0) << false;
+ QTest::newRow("zero, hasHeightForWidth") << qreal(0.0) << true;
+ QTest::newRow("17, hasHeightForWidth") << qreal(17.0) << true;
}
// public void setSpacing(qreal spacing)
void tst_QGraphicsGridLayout::setSpacing()
{
QFETCH(qreal, spacing);
+ QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
scene.addItem(widget);
widget->setLayout(layout);
- populateLayout(layout, 3, 2);
+ populateLayout(layout, 3, 2, hasHeightForWidth);
layout->setContentsMargins(0, 0, 0, 0);
QSizeF sh = layout->sizeHint(Qt::PreferredSize, QSizeF());
qreal oldVSpacing = layout->verticalSpacing();
@@ -1538,8 +1672,18 @@ void tst_QGraphicsGridLayout::verticalSpacing()
delete widget;
}
+void tst_QGraphicsGridLayout::layoutDirection_data()
+{
+ QTest::addColumn<bool>("hasHeightForWidth");
+
+ QTest::newRow("") << false;
+ QTest::newRow("hasHeightForWidth") << true;
+}
+
void tst_QGraphicsGridLayout::layoutDirection()
{
+ QFETCH(bool, hasHeightForWidth);
+
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -1562,6 +1706,12 @@ void tst_QGraphicsGridLayout::layoutDirection()
w4->setMinimumSize(30, 20);
layout->addItem(w4, 1, 1);
+ QSizePolicy policy = w1->sizePolicy();
+ policy.setHeightForWidth(hasHeightForWidth);
+ w1->setSizePolicy(policy);
+ w2->setSizePolicy(policy);
+ w4->setSizePolicy(policy);
+
layout->setAlignment(w2, Qt::AlignRight);
layout->setAlignment(w3, Qt::AlignLeft);
@@ -2200,9 +2350,9 @@ void tst_QGraphicsGridLayout::geometries_data()
.preferredSize(QSizeF(50,10))
.maxSize(QSizeF(100, 100))
<< ItemDesc(1,1)
- .minSize(QSizeF(40,40))
- .preferredSize(QSizeF(50,400))
- .maxSize(QSizeF(500, 500))
+ .minSize(QSizeF(40,-1))
+ .preferredSize(QSizeF(50,-1))
+ .maxSize(QSizeF(500, -1))
.heightForWidth(hfw1)
)
<< QSizeF(100, 401)
@@ -2211,32 +2361,6 @@ void tst_QGraphicsGridLayout::geometries_data()
<< QRectF(0, 1, 50,100) << QRectF(50, 1, 50,400)
);
-
- QTest::newRow("hfw-h408") << (ItemList()
- << ItemDesc(0,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(0,1)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,1)
- .minSize(QSizeF(40,40))
- .preferredSize(QSizeF(50,400))
- .maxSize(QSizeF(500, 500))
- .heightForWidth(hfw1)
- )
- << QSizeF(100, 408)
- << (RectList()
- << QRectF(0, 0, 50, 8) << QRectF(50, 0, 50, 8)
- << QRectF(0, 8, 50,100) << QRectF(50, 8, 50,400)
- );
-
QTest::newRow("hfw-h410") << (ItemList()
<< ItemDesc(0,0)
.minSize(QSizeF(1,1))
@@ -2262,109 +2386,6 @@ void tst_QGraphicsGridLayout::geometries_data()
<< QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400)
);
- QTest::newRow("hfw-h470") << (ItemList()
- << ItemDesc(0,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(0,1)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,1)
- .minSize(QSizeF(40,40))
- .preferredSize(QSizeF(50,400))
- .maxSize(QSizeF(500, 500))
- .heightForWidth(hfw1)
- )
- << QSizeF(100, 470)
- << (RectList()
- << QRectF(0, 0, 50,70) << QRectF(50, 0, 50,70)
- << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400)
- );
-
-
- // change layout width and verify
- QTest::newRow("hfw-w100") << (ItemList()
- << ItemDesc(0,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(0,1)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,1)
- .minSize(QSizeF(40,40))
- .preferredSize(QSizeF(50,400))
- .maxSize(QSizeF(5000, 5000))
- .heightForWidth(hfw1)
- )
- << QSizeF(100, 401)
- << (RectList()
- << QRectF( 0, 0, 50, 1) << QRectF( 50, 0, 50, 1)
- << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400)
- );
-
- QTest::newRow("hfw-w160") << (ItemList()
- << ItemDesc(0,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(0,1)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,1)
- .minSize(QSizeF(40,40))
- .preferredSize(QSizeF(50,400))
- .maxSize(QSizeF(5000, 5000))
- .heightForWidth(hfw1)
- )
- << QSizeF(160, 401)
- << (RectList()
- << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100)
- << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250)
- );
-
-
- QTest::newRow("hfw-w500") << (ItemList()
- << ItemDesc(0,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(0,1)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,0)
- .minSize(QSizeF(1,1))
- .preferredSize(QSizeF(50,10))
- .maxSize(QSizeF(100, 100))
- << ItemDesc(1,1)
- .minSize(QSizeF(40,40))
- .preferredSize(QSizeF(50,400))
- .maxSize(QSizeF(5000, 5000))
- .heightForWidth(hfw1)
- )
- << QSizeF(500, 401)
- << (RectList()
- << QRectF( 0, 0, 100, 100) << QRectF(100, 0, 100, 100)
- << QRectF( 0, 100, 100, 100) << QRectF(100, 100, 400, 50)
- );
-
}
void tst_QGraphicsGridLayout::geometries()