QFETCH(QPointF, initialContentPos);
QFETCH(QPointF, changedContentPos);
QFETCH(QPointF, firstDelegatePos);
+ QFETCH(QPointF, resizeContentPos);
QSGView *canvas = createView();
canvas->show();
QVERIFY(item);
QCOMPARE(item->pos(), firstDelegatePos);
+ gridview->positionViewAtEnd();
+ footer->setHeight(10);
+ footer->setWidth(40);
+ QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), resizeContentPos);
+
delete canvas;
}
QTest::addColumn<QPointF>("initialContentPos");
QTest::addColumn<QPointF>("changedContentPos");
QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
// footer1 = 100 x 30
- // footer2 = 100 x 20
+ // footer2 = 50 x 20
// cells = 80 * 60
// view width = 240
+ // view height = 320
// footer below items, bottom left
QTest::newRow("flow left to right") << QSGGridView::LeftToRight << Qt::LeftToRight
<< QPointF(0, 10 * 60) // 30 items = 10 rows
<< QPointF(0, 0)
<< QPointF(0, 0)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(0, 10 * 60 - 320 + 10);
// footer below items, bottom right
QTest::newRow("flow left to right, layout right to left") << QSGGridView::LeftToRight << Qt::RightToLeft
<< QPointF((240 - 100) + 50, 10 * 60) // 50 = width diff between old and new footers
<< QPointF(0, 0)
<< QPointF(0, 0)
- << QPointF(240 - 80, 0);
+ << QPointF(240 - 80, 0)
+ << QPointF(0, 10 * 60 - 320 + 10);
// footer to right of items
QTest::newRow("flow top to bottom, layout left to right") << QSGGridView::TopToBottom << Qt::LeftToRight
<< QPointF(6 * 80, 0) // 30 items = 6 columns
<< QPointF(0, 0)
<< QPointF(0, 0)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(6 * 80 - 240 + 40, 0);
// footer to left of items
QTest::newRow("flow top to bottom, layout right to left") << QSGGridView::TopToBottom << Qt::RightToLeft
<< QPointF(-(6 * 80) - 50, 0) // 50 = new footer width
<< QPointF(-240, 0)
<< QPointF(-240, 0) // unchanged, footer change doesn't change content pos
- << QPointF(-80, 0);
+ << QPointF(-80, 0)
+ << QPointF(-(6 * 80) - 40, 0);
}
void tst_QSGGridView::header()
QFETCH(QPointF, initialContentPos);
QFETCH(QPointF, changedContentPos);
QFETCH(QPointF, firstDelegatePos);
+ QFETCH(QPointF, resizeContentPos);
QSGView *canvas = createView();
QVERIFY(item);
QCOMPARE(item->pos(), firstDelegatePos);
+ header->setHeight(10);
+ header->setWidth(40);
+ QTRY_COMPARE(QPointF(gridview->contentX(), gridview->contentY()), resizeContentPos);
+
delete canvas;
}
QTest::addColumn<QPointF>("initialContentPos");
QTest::addColumn<QPointF>("changedContentPos");
QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
// header1 = 100 x 30
- // header2 = 100 x 20
+ // header2 = 50 x 20
// cells = 80 x 60
// view width = 240
<< QPointF(0, -20)
<< QPointF(0, -30)
<< QPointF(0, -20)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(0, -10);
// header above items, top right
QTest::newRow("flow left to right, layout right to left") << QSGGridView::LeftToRight << Qt::RightToLeft
<< QPointF((240 - 100) + 50, -20) // 50 = width diff between old and new headers
<< QPointF(0, -30)
<< QPointF(0, -20)
- << QPointF(160, 0);
+ << QPointF(160, 0)
+ << QPointF(0, -10);
// header to left of items
QTest::newRow("flow top to bottom, layout left to right") << QSGGridView::TopToBottom << Qt::LeftToRight
<< QPointF(-50, 0)
<< QPointF(-100, 0)
<< QPointF(-50, 0)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(-40, 0);
// header to right of items
QTest::newRow("flow top to bottom, layout right to left") << QSGGridView::TopToBottom << Qt::RightToLeft
<< QPointF(0, 0)
<< QPointF(-(240 - 100), 0)
<< QPointF(-(240 - 50), 0)
- << QPointF(-80, 0);
+ << QPointF(-80, 0)
+ << QPointF(-(240 - 40), 0);
}
void tst_QSGGridView::indexAt()
QFETCH(QPointF, initialContentPos);
QFETCH(QPointF, changedHeaderPos);
QFETCH(QPointF, changedContentPos);
+ QFETCH(QPointF, resizeContentPos);
QSGView *canvas = createView();
QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), changedContentPos);
QCOMPARE(item->pos(), firstDelegatePos);
+ header->setHeight(10);
+ header->setWidth(40);
+ QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), resizeContentPos);
+
delete canvas;
}
QTest::addColumn<QPointF>("initialContentPos");
QTest::addColumn<QPointF>("changedContentPos");
QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
// header1 = 100 x 30
// header2 = 50 x 20
<< QPointF(0, -20)
<< QPointF(0, -30)
<< QPointF(0, -20)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(0, -10);
// header above items, top right
QTest::newRow("vertical, layout right to left") << QSGListView::Vertical << Qt::RightToLeft
<< QPointF(0, -20)
<< QPointF(0, -30)
<< QPointF(0, -20)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(0, -10);
// header to left of items
QTest::newRow("horizontal, layout left to right") << QSGListView::Horizontal << Qt::LeftToRight
<< QPointF(-50, 0)
<< QPointF(-100, 0)
<< QPointF(-50, 0)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(-40, 0);
// header to right of items
QTest::newRow("horizontal, layout right to left") << QSGListView::Horizontal << Qt::RightToLeft
<< QPointF(0, 0)
<< QPointF(-240 + 100, 0)
<< QPointF(-240 + 50, 0)
- << QPointF(-240, 0);
+ << QPointF(-240, 0)
+ << QPointF(-240 + 40, 0);
}
void tst_QSGListView::header_delayItemCreation()
QFETCH(QPointF, initialContentPos);
QFETCH(QPointF, changedFooterPos);
QFETCH(QPointF, changedContentPos);
+ QFETCH(QPointF, resizeContentPos);
QSGView *canvas = createView();
QVERIFY(item);
QCOMPARE(item->pos(), firstDelegatePos);
+ listview->positionViewAtEnd();
+ footer->setHeight(10);
+ footer->setWidth(40);
+ QTRY_COMPARE(QPointF(listview->contentX(), listview->contentY()), resizeContentPos);
+
delete canvas;
}
QTest::addColumn<QPointF>("initialContentPos");
QTest::addColumn<QPointF>("changedContentPos");
QTest::addColumn<QPointF>("firstDelegatePos");
+ QTest::addColumn<QPointF>("resizeContentPos");
// footer1 = 100 x 30
- // footer2 = 100 x 20
+ // footer2 = 50 x 20
// delegates = 40 x 20
// view width = 240
+ // view height = 320
// footer below items, bottom left
QTest::newRow("vertical, layout left to right") << QSGListView::Vertical << Qt::LeftToRight
<< QPointF(0, 30 * 20) // added 30 items
<< QPointF(0, 0)
<< QPointF(0, 0)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(0, 30 * 20 - 320 + 10);
// footer below items, bottom right
QTest::newRow("vertical, layout right to left") << QSGListView::Vertical << Qt::RightToLeft
<< QPointF(0, 30 * 20)
<< QPointF(0, 0)
<< QPointF(0, 0)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(0, 30 * 20 - 320 + 10);
// footer to right of items
QTest::newRow("horizontal, layout left to right") << QSGListView::Horizontal << Qt::LeftToRight
<< QPointF(40 * 30, 0)
<< QPointF(0, 0)
<< QPointF(0, 0)
- << QPointF(0, 0);
+ << QPointF(0, 0)
+ << QPointF(40 * 30 - 240 + 40, 0);
// footer to left of items
QTest::newRow("horizontal, layout right to left") << QSGListView::Horizontal << Qt::RightToLeft
<< QPointF(-(40 * 30) - 50, 0) // 50 = new footer width
<< QPointF(-240, 0)
<< QPointF(-240, 0)
- << QPointF(-40, 0);
+ << QPointF(-40, 0)
+ << QPointF(-(40 * 30) - 40, 0);
}
class LVAccessor : public QSGListView