tst_qquickimage: modernize
Replace foreach with ranged-for and brace-initialize lists.
Change-Id: Ieccebcf953d36ffa1dcaf0a1eebef21f2e9074a4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e62f489209
)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
bb61f110fe
commit
981c6262d8
|
@ -308,15 +308,19 @@ void tst_qquickimage::mirror()
|
|||
QSKIP("Skipping due to grabWindow not functional on minimal platforms");
|
||||
|
||||
QMap<QQuickImage::FillMode, QImage> screenshots;
|
||||
QList<QQuickImage::FillMode> fillModes;
|
||||
fillModes << QQuickImage::Stretch << QQuickImage::PreserveAspectFit << QQuickImage::PreserveAspectCrop
|
||||
<< QQuickImage::Tile << QQuickImage::TileVertically << QQuickImage::TileHorizontally << QQuickImage::Pad;
|
||||
const QList<QQuickImage::FillMode> fillModes{QQuickImage::Stretch,
|
||||
QQuickImage::PreserveAspectFit,
|
||||
QQuickImage::PreserveAspectCrop,
|
||||
QQuickImage::Tile,
|
||||
QQuickImage::TileVertically,
|
||||
QQuickImage::TileHorizontally,
|
||||
QQuickImage::Pad};
|
||||
|
||||
qreal width = 300;
|
||||
qreal height = 250;
|
||||
qreal devicePixelRatio = 1.0;
|
||||
|
||||
foreach (QQuickImage::FillMode fillMode, fillModes) {
|
||||
for (QQuickImage::FillMode fillMode : fillModes) {
|
||||
QScopedPointer<QQuickView> window(new QQuickView);
|
||||
window->setSource(testFileUrl("mirror.qml"));
|
||||
|
||||
|
@ -333,7 +337,7 @@ void tst_qquickimage::mirror()
|
|||
devicePixelRatio = window->devicePixelRatio();
|
||||
}
|
||||
|
||||
foreach (QQuickImage::FillMode fillMode, fillModes) {
|
||||
for (QQuickImage::FillMode fillMode : fillModes) {
|
||||
QPixmap srcPixmap;
|
||||
QVERIFY(srcPixmap.load(testFile("pattern.png")));
|
||||
|
||||
|
@ -453,9 +457,8 @@ void tst_qquickimage::geometry_data()
|
|||
QTest::newRow("PreserveAspectCrop explicit width 300, height 400") << "PreserveAspectCrop" << true << true << 300.0 << 800.0 << 800.0 << 400.0 << 400.0 << 400.0;
|
||||
|
||||
// bounding rect, painted rect and item rect are equal in stretching and tiling images
|
||||
QStringList fillModes;
|
||||
fillModes << "Stretch" << "Tile" << "TileVertically" << "TileHorizontally";
|
||||
foreach (QString fillMode, fillModes) {
|
||||
QStringList fillModes{"Stretch", "Tile", "TileVertically", "TileHorizontally"};
|
||||
for (const auto &fillMode : fillModes) {
|
||||
QTest::newRow(fillMode.toLatin1()) << fillMode << false << false << 200.0 << 200.0 << 200.0 << 100.0 << 100.0 << 100.0;
|
||||
QTest::newRow(QString(fillMode + " explicit width 300").toLatin1()) << fillMode << true << false << 300.0 << 300.0 << 300.0 << 100.0 << 100.0 << 100.0;
|
||||
QTest::newRow(QString(fillMode + " explicit height 400").toLatin1()) << fillMode << false << true << 200.0 << 200.0 << 200.0 << 400.0 << 400.0 << 400.0;
|
||||
|
|
Loading…
Reference in New Issue