summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-06-12 12:40:54 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-06-22 11:38:32 +0200
commita6bd2da2ab62eccae023789899b4f0b6b5e60f74 (patch)
treeb91df1239788934715ebbc29b23b2f0ca72d0b1d /tests/auto/widgets/kernel
parent3fe44ddb9d94d3b2ab2b3a16c6ea13da5624dd1e (diff)
QWidgetAction: add test for defaultWidget() being deleted before action
... even though the documentation states that the action takes ownership of the widget. Change-Id: Ie5520fbda295a5a2774ff8b82165070e9d49e310 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
index 384c07258b..1b43961182 100644
--- a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
+++ b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp
@@ -74,6 +74,18 @@ void tst_QWidgetAction::cleanup()
void tst_QWidgetAction::defaultWidget()
{
+ // check that QWidgetAction deals with the widget being deleted before itself:
+ {
+ QToolBar tb1;
+
+ QComboBox combo(&tb1);
+
+ auto action = new QWidgetAction(&tb1);
+ action->setDefaultWidget(&combo);
+
+ tb1.addAction(action);
+ }
+ // check that QWidgetAction takes ownership of the widget:
{
QToolBar tb1;