summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp6
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp12
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp15
3 files changed, 18 insertions, 15 deletions
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 71b55d71ea..b496550f85 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -329,7 +329,7 @@ void tst_QAction::enabledVisibleInteraction()
void tst_QAction::task200823_tooltip()
{
- QAction *action = new QAction("foo", 0);
+ const QScopedPointer<QAction> action(new QAction("foo", Q_NULLPTR));
QString shortcut("ctrl+o");
action->setShortcut(shortcut);
@@ -343,8 +343,8 @@ void tst_QAction::task200823_tooltip()
void tst_QAction::task229128TriggeredSignalWithoutActiongroup()
{
// test without a group
- QAction *actionWithoutGroup = new QAction("Test", qApp);
- QSignalSpy spyWithoutGroup(actionWithoutGroup, SIGNAL(triggered(bool)));
+ const QScopedPointer<QAction> actionWithoutGroup(new QAction("Test", Q_NULLPTR));
+ QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), SIGNAL(triggered(bool)));
QCOMPARE(spyWithoutGroup.count(), 0);
actionWithoutGroup->trigger();
// signal should be emitted
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 87a189fc87..424069c8ae 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -2211,8 +2211,8 @@ void tst_QApplication::noQuitOnHide()
{
int argc = 0;
QApplication app(argc, 0);
- QWidget *window1 = new NoQuitOnHideWidget;
- window1->show();
+ NoQuitOnHideWidget window1;
+ window1.show();
QCOMPARE(app.exec(), 1);
}
@@ -2246,12 +2246,12 @@ void tst_QApplication::abortQuitOnShow()
{
int argc = 0;
QApplication app(argc, 0);
- QWidget *window1 = new ShowCloseShowWidget(false);
- window1->show();
+ ShowCloseShowWidget window1(false);
+ window1.show();
QCOMPARE(app.exec(), 0);
- QWidget *window2 = new ShowCloseShowWidget(true);
- window2->show();
+ ShowCloseShowWidget window2(true);
+ window2.show();
QCOMPARE(app.exec(), 1);
}
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index e1b494c9f1..5703d7e114 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -395,7 +395,8 @@ void tst_QFormLayout::setFormStyle()
QCOMPARE(layout.rowWrapPolicy(), QFormLayout::DontWrapRows);
#endif
- widget.setStyle(QStyleFactory::create("windows"));
+ const QScopedPointer<QStyle> windowsStyle(QStyleFactory::create("windows"));
+ widget.setStyle(windowsStyle.data());
QCOMPARE(layout.labelAlignment(), Qt::AlignLeft);
QVERIFY(layout.formAlignment() == (Qt::AlignLeft | Qt::AlignTop));
@@ -406,14 +407,16 @@ void tst_QFormLayout::setFormStyle()
this test is cross platform.. so create dummy styles that
return all the right stylehints.
*/
- widget.setStyle(new DummyMacStyle());
+ DummyMacStyle macStyle;
+ widget.setStyle(&macStyle);
QCOMPARE(layout.labelAlignment(), Qt::AlignRight);
QVERIFY(layout.formAlignment() == (Qt::AlignHCenter | Qt::AlignTop));
QCOMPARE(layout.fieldGrowthPolicy(), QFormLayout::FieldsStayAtSizeHint);
QCOMPARE(layout.rowWrapPolicy(), QFormLayout::DontWrapRows);
- widget.setStyle(new DummyQtopiaStyle());
+ DummyQtopiaStyle qtopiaStyle;
+ widget.setStyle(&qtopiaStyle);
QCOMPARE(layout.labelAlignment(), Qt::AlignRight);
QVERIFY(layout.formAlignment() == (Qt::AlignLeft | Qt::AlignTop));
@@ -891,7 +894,7 @@ void tst_QFormLayout::takeAt()
QCOMPARE(layout->count(), 7);
for (int i = 6; i >= 0; --i) {
- layout->takeAt(0);
+ delete layout->takeAt(0);
QCOMPARE(layout->count(), i);
}
}
@@ -983,7 +986,7 @@ void tst_QFormLayout::replaceWidget()
QFormLayout::ItemRole role;
// replace editor
- layout->replaceWidget(edit1, edit3);
+ delete layout->replaceWidget(edit1, edit3);
edit1->hide(); // Not strictly needed for the test, but for normal usage it is.
QCOMPARE(layout->indexOf(edit1), -1);
QCOMPARE(layout->indexOf(edit3), editIndex);
@@ -994,7 +997,7 @@ void tst_QFormLayout::replaceWidget()
QCOMPARE(rownum, 0);
QCOMPARE(role, QFormLayout::FieldRole);
- layout->replaceWidget(label1, label2);
+ delete layout->replaceWidget(label1, label2);
label1->hide();
QCOMPARE(layout->indexOf(label1), -1);
QCOMPARE(layout->indexOf(label2), labelIndex);