Add check for top level widget leaks in kernel test of QtWidgets.

Add a cleanup function for the check and disable animations
in tst_qwidgetaction to prevent effect widgets from interfering
(vista style animations).

Change-Id: I043ecb131c8dcd07b6ef10bc75c9e010ab569e85
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
bb10
Friedemann Kleint 2015-06-11 12:11:22 +02:00
parent 05fa4ac7df
commit 8d5516b585
6 changed files with 20 additions and 0 deletions

View File

@ -42,6 +42,7 @@ class tst_QActionGroup : public QObject
Q_OBJECT
private slots:
void cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); }
void enabledPropagation();
void visiblePropagation();
void exclusive();

View File

@ -73,6 +73,7 @@ void tst_QDesktopWidget::init()
void tst_QDesktopWidget::cleanup()
{
QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
void tst_QDesktopWidget::numScreens()

View File

@ -66,6 +66,7 @@ public:
virtual ~tst_QLayout();
private slots:
void cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); }
void getSetCheck();
void geometry();
void smartMaxSize();

View File

@ -108,6 +108,7 @@ public slots:
public slots:
void initTestCase();
void cleanupTestCase();
void cleanup() { QCOMPARE(QApplication::topLevelWidgets().size(), 1); }
private slots:
void number_data();

View File

@ -44,6 +44,7 @@ class tst_QSizePolicy : public QObject
Q_OBJECT
private Q_SLOTS:
void cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); }
void qtest();
void defaultValues();
void getSetCheck_data() { data(); }

View File

@ -55,6 +55,8 @@ class tst_QWidgetAction : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void cleanup();
void defaultWidget();
void visibilityUpdate();
void customWidget();
@ -65,6 +67,19 @@ private slots:
void releaseWidgetCrash();
};
void tst_QWidgetAction::initTestCase()
{
// Disable menu/combo animations to prevent the alpha widgets from getting in the
// way in popup(), failing the top level leak check in cleanup().
QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false);
QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false);
}
void tst_QWidgetAction::cleanup()
{
QVERIFY(QApplication::topLevelWidgets().isEmpty());
}
void tst_QWidgetAction::defaultWidget()
{
{