summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp')
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp174
1 files changed, 94 insertions, 80 deletions
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 2a0ba93803..c0afed6919 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QFont>
@@ -17,6 +17,10 @@
#include <QSignalSpy>
#include <QOperatingSystemVersion>
+#include <QtWidgets/private/qapplication_p.h>
+
+#include <memory>
+
Q_DECLARE_METATYPE(QWizard::WizardButton);
static QImage grabWidget(QWidget *window)
@@ -396,7 +400,7 @@ void tst_QWizard::setPixmap()
QVERIFY(wizard.pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(wizard.pixmap(QWizard::WatermarkPixmap).isNull());
- if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::MacOSHighSierra)
+ if (QOperatingSystemVersion::currentType() == QOperatingSystemVersion::MacOS)
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
else
QVERIFY(wizard.pixmap(QWizard::BackgroundPixmap).isNull());
@@ -404,7 +408,7 @@ void tst_QWizard::setPixmap()
QVERIFY(page->pixmap(QWizard::BannerPixmap).isNull());
QVERIFY(page->pixmap(QWizard::LogoPixmap).isNull());
QVERIFY(page->pixmap(QWizard::WatermarkPixmap).isNull());
- if (QOperatingSystemVersion::current() <= QOperatingSystemVersion::MacOSHighSierra)
+ if (QOperatingSystemVersion::currentType() == QOperatingSystemVersion::MacOS)
QVERIFY(!wizard.pixmap(QWizard::BackgroundPixmap).isNull());
else
QVERIFY(page->pixmap(QWizard::BackgroundPixmap).isNull());
@@ -522,7 +526,7 @@ void tst_QWizard::addPage()
QCOMPARE(wizard.addPage(pages[i]), i);
QCOMPARE(pages[i]->window(), (QWidget *)&wizard);
QCOMPARE(wizard.startId(), 0);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), i);
}
@@ -535,37 +539,37 @@ void tst_QWizard::addPage()
QVERIFY(!wizard.page(N + 1));
wizard.setPage(N + 50, new QWizardPage);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), N + 50);
wizard.setPage(-3000, new QWizardPage);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), -3000);
QWizardPage *pageX = new QWizardPage;
QCOMPARE(wizard.addPage(pageX), N + 51);
QCOMPARE(wizard.page(N + 51), pageX);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), N + 51);
QCOMPARE(wizard.addPage(new QWizardPage), N + 52);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), N + 52);
QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page");
wizard.addPage(0); // generates a warning
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
delete parent;
}
#define CHECK_VISITED(wizard, list) \
do { \
- QList<int> myList = list; \
+ const QList<int> myList = list; \
QCOMPARE((wizard).visitedIds(), myList); \
- Q_FOREACH(int id, myList) \
+ for (int id : myList) \
QVERIFY((wizard).hasVisitedPage(id)); \
} while (0)
@@ -584,7 +588,7 @@ void tst_QWizard::setPage()
page = new QWizardPage(parent);
QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1");
wizard.setPage(-1, page); // gives a warning and does nothing
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
QVERIFY(!wizard.page(-2));
QVERIFY(!wizard.page(-1));
QVERIFY(!wizard.page(0));
@@ -596,7 +600,7 @@ void tst_QWizard::setPage()
page = new QWizardPage(parent);
wizard.setPage(0, page);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 0);
QCOMPARE(page->window(), (QWidget *)&wizard);
@@ -609,7 +613,7 @@ void tst_QWizard::setPage()
page = new QWizardPage(parent);
wizard.setPage(-2, page);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), -2);
QCOMPARE(page->window(), (QWidget *)&wizard);
@@ -630,7 +634,7 @@ void tst_QWizard::setPage()
page = new QWizardPage(parent);
wizard.setPage(2, page);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 2);
QCOMPARE(wizard.page(2), page);
@@ -649,7 +653,7 @@ void tst_QWizard::setPage()
page = new QWizardPage(parent);
wizard.setPage(-3, page);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), -3);
QCOMPARE(wizard.page(-3), page);
@@ -720,7 +724,7 @@ void tst_QWizard::setPage()
QCOMPARE(wizard.nextId(), -2);
CHECK_VISITED(wizard, QList<int>() << -3);
}
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
delete parent;
}
@@ -978,7 +982,7 @@ void tst_QWizard::setOption_IgnoreSubTitles()
// Check that subtitles are shown when they should (i.e.,
// they're set and IgnoreSubTitles is off).
- qApp->setActiveWindow(0); // ensure no focus rectangle around cancel button
+ QApplicationPrivate::setActiveWindow(0); // ensure no focus rectangle around cancel button
QImage i11 = grabWidget(&wizard1);
QImage i21 = grabWidget(&wizard2);
QVERIFY(i11 != i21);
@@ -1579,9 +1583,9 @@ class SetPage : public Operation
QString describe() const override { return QLatin1String("set page ") + QString::number(page); }
int page;
public:
- static QSharedPointer<SetPage> create(int page)
+ static std::shared_ptr<SetPage> create(int page)
{
- QSharedPointer<SetPage> o = QSharedPointer<SetPage>::create();
+ std::shared_ptr<SetPage> o = std::make_shared<SetPage>();
o->page = page;
return o;
}
@@ -1593,9 +1597,9 @@ class SetStyle : public Operation
QString describe() const override { return QLatin1String("set style ") + QString::number(style); }
QWizard::WizardStyle style;
public:
- static QSharedPointer<SetStyle> create(QWizard::WizardStyle style)
+ static std::shared_ptr<SetStyle> create(QWizard::WizardStyle style)
{
- QSharedPointer<SetStyle> o = QSharedPointer<SetStyle>::create();
+ std::shared_ptr<SetStyle> o = std::make_shared<SetStyle>();
o->style = style;
return o;
}
@@ -1608,9 +1612,9 @@ class SetOption : public Operation
QWizard::WizardOption option;
bool on;
public:
- static QSharedPointer<SetOption> create(QWizard::WizardOption option, bool on)
+ static std::shared_ptr<SetOption> create(QWizard::WizardOption option, bool on)
{
- QSharedPointer<SetOption> o = QSharedPointer<SetOption>::create();
+ std::shared_ptr<SetOption> o = std::make_shared<SetOption>();
o->option = option;
o->on = on;
return o;
@@ -1639,8 +1643,8 @@ class OptionInfo
tags[QWizard::HaveCustomButton3] = "15/CB3";
for (int i = 0; i < 2; ++i) {
- QMap<QWizard::WizardOption, QSharedPointer<Operation> > operations_;
- foreach (QWizard::WizardOption option, tags.keys())
+ QMap<QWizard::WizardOption, std::shared_ptr<Operation> > operations_;
+ for (const auto &[option, _] : std::as_const(tags).asKeyValueRange())
operations_[option] = SetOption::create(option, i == 1);
operations << operations_;
}
@@ -1648,7 +1652,7 @@ class OptionInfo
OptionInfo(OptionInfo const&);
OptionInfo& operator=(OptionInfo const&);
QMap<QWizard::WizardOption, QString> tags;
- QList<QMap<QWizard::WizardOption, QSharedPointer<Operation> > > operations;
+ QList<QMap<QWizard::WizardOption, std::shared_ptr<Operation> > > operations;
public:
static OptionInfo &instance()
{
@@ -1657,7 +1661,7 @@ public:
}
QString tag(QWizard::WizardOption option) const { return tags.value(option); }
- QSharedPointer<Operation> operation(QWizard::WizardOption option, bool on) const
+ std::shared_ptr<Operation> operation(QWizard::WizardOption option, bool on) const
{ return operations.at(on).value(option); }
QList<QWizard::WizardOption> options() const { return tags.keys(); }
};
@@ -1668,7 +1672,7 @@ QString SetOption::describe() const
+ QLatin1Char(on ? '1' : '0');
}
-Q_DECLARE_METATYPE(QList<QSharedPointer<Operation>>)
+Q_DECLARE_METATYPE(QList<std::shared_ptr<Operation>>)
class TestGroup
{
@@ -1685,7 +1689,7 @@ public:
combinations.clear();
}
- QList<QSharedPointer<Operation>> &add()
+ QList<std::shared_ptr<Operation>> &add()
{
combinations.resize(combinations.size() + 1);
return combinations.last();
@@ -1693,7 +1697,7 @@ public:
void createTestRows()
{
- for (int i = 0; i < combinations.count(); ++i) {
+ for (int i = 0; i < combinations.size(); ++i) {
QTest::newRow((name.toLatin1() + ", row " + QByteArray::number(i)).constData())
<< (i == 0) << (type == Equality) << combinations.at(i);
++nRows_;
@@ -1706,7 +1710,7 @@ private:
QString name;
Type type;
int nRows_;
- QList<QList<QSharedPointer<Operation>>> combinations;
+ QList<QList<std::shared_ptr<Operation>>> combinations;
};
class IntroPage : public QWizardPage
@@ -1783,16 +1787,16 @@ public:
~TestWizard()
{
- foreach (int id, pageIds) {
+ for (int id : std::as_const(pageIds)) {
QWizardPage *page_to_delete = page(id);
removePage(id);
delete page_to_delete;
}
}
- void applyOperations(const QList<QSharedPointer<Operation>> &operations)
+ void applyOperations(const QList<std::shared_ptr<Operation>> &operations)
{
- foreach (const QSharedPointer<Operation> &op, operations) {
+ for (const std::shared_ptr<Operation> &op : operations) {
if (op) {
op->apply(this);
opsDescr += QLatin1Char('(') + op->describe() + QLatin1String(") ");
@@ -1812,25 +1816,31 @@ public:
class CombinationsTestData
{
TestGroup testGroup;
- QList<QSharedPointer<Operation>> pageOps;
- QList<QSharedPointer<Operation>> styleOps;
- QMap<bool, QList<QSharedPointer<Operation>>> setAllOptions;
+ const std::shared_ptr<Operation> pageOps[3] = {
+ SetPage::create(0),
+ SetPage::create(1),
+ SetPage::create(2),
+ };
+ const std::shared_ptr<Operation> styleOps[3] = {
+ SetStyle::create(QWizard::ClassicStyle),
+ SetStyle::create(QWizard::ModernStyle),
+ SetStyle::create(QWizard::MacStyle),
+ };
+ QMap<bool, QList<std::shared_ptr<Operation>>> setAllOptions;
public:
CombinationsTestData()
{
QTest::addColumn<bool>("ref");
QTest::addColumn<bool>("testEquality");
- QTest::addColumn<QList<QSharedPointer<Operation>>>("operations");
- pageOps << SetPage::create(0) << SetPage::create(1) << SetPage::create(2);
- styleOps << SetStyle::create(QWizard::ClassicStyle) << SetStyle::create(QWizard::ModernStyle)
- << SetStyle::create(QWizard::MacStyle);
-#define SETPAGE(page) pageOps.at(page)
-#define SETSTYLE(style) styleOps.at(style)
+ QTest::addColumn<QList<std::shared_ptr<Operation>>>("operations");
+#define SETPAGE(page) pageOps[page]
+#define SETSTYLE(style) styleOps[style]
#define OPT(option, on) OptionInfo::instance().operation(option, on)
#define CLROPT(option) OPT(option, false)
#define SETOPT(option) OPT(option, true)
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
setAllOptions[false] << CLROPT(option);
setAllOptions[true] << SETOPT(option);
}
@@ -1887,7 +1897,7 @@ public:
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
- QList<QSharedPointer<Operation>> setOptions = setAllOptions.value(i == 1);
+ QList<std::shared_ptr<Operation>> setOptions = setAllOptions.value(i == 1);
testGroup.reset("testAll 3.1");
testGroup.add() << setOptions;
@@ -1904,21 +1914,22 @@ public:
testGroup.createTestRows();
}
- foreach (const QSharedPointer<Operation> &pageOp, pageOps) {
+ for (const std::shared_ptr<Operation> &pageOp : pageOps) {
testGroup.reset("testAll 4.1");
testGroup.add() << pageOp;
testGroup.add() << pageOp << pageOp;
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
- QList<QSharedPointer<Operation>> optionOps = setAllOptions.value(i == 1);
+ QList<std::shared_ptr<Operation>> optionOps = setAllOptions.value(i == 1);
testGroup.reset("testAll 4.2");
testGroup.add() << optionOps << pageOp;
testGroup.add() << pageOp << optionOps;
testGroup.createTestRows();
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
- QSharedPointer<Operation> optionOp = OPT(option, i == 1);
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
+ std::shared_ptr<Operation> optionOp = OPT(option, i == 1);
testGroup.reset("testAll 4.3");
testGroup.add() << optionOp << pageOp;
testGroup.add() << pageOp << optionOp;
@@ -1927,21 +1938,22 @@ public:
}
}
- foreach (const QSharedPointer<Operation> &styleOp, styleOps) {
+ for (const std::shared_ptr<Operation> &styleOp : styleOps) {
testGroup.reset("testAll 5.1");
testGroup.add() << styleOp;
testGroup.add() << styleOp << styleOp;
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
- QList<QSharedPointer<Operation>> optionOps = setAllOptions.value(i == 1);
+ QList<std::shared_ptr<Operation>> optionOps = setAllOptions.value(i == 1);
testGroup.reset("testAll 5.2");
testGroup.add() << optionOps << styleOp;
testGroup.add() << styleOp << optionOps;
testGroup.createTestRows();
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
- QSharedPointer<Operation> optionOp = OPT(option, i == 1);
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
+ std::shared_ptr<Operation> optionOp = OPT(option, i == 1);
testGroup.reset("testAll 5.3");
testGroup.add() << optionOp << styleOp;
testGroup.add() << styleOp << optionOp;
@@ -1950,8 +1962,8 @@ public:
}
}
- foreach (const QSharedPointer<Operation> &pageOp, pageOps) {
- foreach (const QSharedPointer<Operation> &styleOp, styleOps) {
+ for (const std::shared_ptr<Operation> &pageOp : pageOps) {
+ for (const std::shared_ptr<Operation> &styleOp : styleOps) {
testGroup.reset("testAll 6.1");
testGroup.add() << pageOp;
@@ -1969,7 +1981,7 @@ public:
testGroup.createTestRows();
for (int i = 0; i < 2; ++i) {
- QList<QSharedPointer<Operation>> optionOps = setAllOptions.value(i == 1);
+ QList<std::shared_ptr<Operation>> optionOps = setAllOptions.value(i == 1);
testGroup.reset("testAll 6.4");
testGroup.add() << optionOps << pageOp << styleOp;
testGroup.add() << pageOp << optionOps << styleOp;
@@ -1979,8 +1991,9 @@ public:
testGroup.add() << styleOp << pageOp << optionOps;
testGroup.createTestRows();
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
- QSharedPointer<Operation> optionOp = OPT(option, i == 1);
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
+ std::shared_ptr<Operation> optionOp = OPT(option, i == 1);
testGroup.reset("testAll 6.5");
testGroup.add() << optionOp << pageOp << styleOp;
testGroup.add() << pageOp << optionOp << styleOp;
@@ -2042,7 +2055,7 @@ void tst_QWizard::combinations()
{
QFETCH(bool, ref);
QFETCH(bool, testEquality);
- QFETCH(QList<QSharedPointer<Operation>>, operations);
+ QFETCH(const QList<std::shared_ptr<Operation>>, operations);
TestWizard wizard;
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
@@ -2111,7 +2124,7 @@ public:
QList<WizardPage *> shown() const
{
QList<WizardPage *> result;
- foreach (WizardPage *page, pages)
+ for (WizardPage *page : pages)
if (page->shown())
result << page;
return result;
@@ -2129,19 +2142,19 @@ void tst_QWizard::showCurrentPageOnly()
wizard.show();
- QCOMPARE(pages.shown().count(), 1);
+ QCOMPARE(pages.shown().size(), 1);
QCOMPARE(pages.shown().first(), pages.all().first());
const int steps = 2;
for (int i = 0; i < steps; ++i)
wizard.next();
- QCOMPARE(pages.shown().count(), 1);
+ QCOMPARE(pages.shown().size(), 1);
QCOMPARE(pages.shown().first(), pages.all().at(steps));
wizard.restart();
- QCOMPARE(pages.shown().count(), 1);
+ QCOMPARE(pages.shown().size(), 1);
QCOMPARE(pages.shown().first(), pages.all().first());
}
@@ -2273,36 +2286,36 @@ void tst_QWizard::removePage()
wizard.restart();
QCOMPARE(wizard.pageIds().size(), 4);
QCOMPARE(wizard.visitedIds().size(), 1);
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
// Removing a non-existent page
wizard.removePage(4);
QCOMPARE(wizard.pageIds().size(), 4);
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
// Removing and then reinserting a page
QCOMPARE(wizard.pageIds().size(), 4);
QVERIFY(wizard.pageIds().contains(2));
wizard.removePage(2);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QList<QVariant> arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 2);
QCOMPARE(wizard.pageIds().size(), 3);
QVERIFY(!wizard.pageIds().contains(2));
wizard.setPage(2, page2);
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
QCOMPARE(wizard.pageIds().size(), 4);
QVERIFY(wizard.pageIds().contains(2));
// Removing the same page twice
wizard.removePage(2); // restore
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 2);
QCOMPARE(wizard.pageIds().size(), 3);
QVERIFY(!wizard.pageIds().contains(2));
wizard.removePage(2);
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
QCOMPARE(wizard.pageIds().size(), 3);
QVERIFY(!wizard.pageIds().contains(2));
@@ -2312,9 +2325,9 @@ void tst_QWizard::removePage()
wizard.next();
QCOMPARE(wizard.visitedIds().size(), 2);
QCOMPARE(wizard.currentPage(), page1);
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
wizard.removePage(2);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 2);
QCOMPARE(wizard.visitedIds().size(), 2);
@@ -2325,11 +2338,11 @@ void tst_QWizard::removePage()
wizard.setPage(2, page2); // restore
wizard.restart();
wizard.next();
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
QCOMPARE(wizard.visitedIds().size(), 2);
QCOMPARE(wizard.currentPage(), page1);
wizard.removePage(0);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 0);
QCOMPARE(wizard.visitedIds().size(), 1);
@@ -2341,11 +2354,11 @@ void tst_QWizard::removePage()
wizard.setPage(0, page0); // restore
wizard.restart();
wizard.next();
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
QCOMPARE(wizard.visitedIds().size(), 2);
QCOMPARE(wizard.currentPage(), page1);
wizard.removePage(1);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 1);
QCOMPARE(wizard.visitedIds().size(), 1);
@@ -2355,7 +2368,7 @@ void tst_QWizard::removePage()
// Remove the current page which is the first (and only) one in the history
wizard.removePage(0);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 0);
QCOMPARE(wizard.visitedIds().size(), 1);
@@ -2365,7 +2378,7 @@ void tst_QWizard::removePage()
QCOMPARE(wizard.currentPage(), page2);
//
wizard.removePage(2);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 2);
QCOMPARE(wizard.visitedIds().size(), 1);
@@ -2375,7 +2388,7 @@ void tst_QWizard::removePage()
QCOMPARE(wizard.currentPage(), page3);
//
wizard.removePage(3);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
arguments = spy.takeFirst();
QCOMPARE(arguments.at(0).toInt(), 3);
QVERIFY(wizard.visitedIds().empty());
@@ -2563,7 +2576,8 @@ void tst_QWizard::task161658_alignments()
wizard.show();
QVERIFY(QTest::qWaitForWindowExposed(&wizard));
- foreach (QLabel *subtitleLabel, wizard.findChildren<QLabel *>()) {
+ const auto subtitleLabels = wizard.findChildren<QLabel *>();
+ for (QLabel *subtitleLabel : subtitleLabels) {
if (subtitleLabel->text().startsWith("SUBTITLE#")) {
QCOMPARE(lineEdit1.mapToGlobal(lineEdit1.contentsRect().bottomRight()).x(),
subtitleLabel->mapToGlobal(subtitleLabel->contentsRect().bottomRight()).x());