qt5base-lts/tests/auto/widgets
Thomas Fischer 983dde1f2f Avoid adding widget to its own layout
Widgets and layouts added or inserted to a layout are checked for:
- Not being NULL
- Not being the parent widget of a layout or the layout itself,
  respectively

Without this commit, adding a widget to its own layout would result in a
CPU-hogging infinite loop. Now, a warning is written to stderr and the
add or insert function call is ignored.

The checks are implemented as public functions of QLayoutPrivate and
thus accessible in QLayout's descendants to be used in various
"addWidget", "insertWidget", etc functions.

Unlike 'classical' layouts like QGridLayout, QFormLayout does indeed
accept widgets that are NULL. To not break this behavior, any call for
the check functions first tests if the widget or layout, respectively,
to test is NULL or not and calls the check only in the latter case.

Automated tests for QBoxLayout, QGridLayout, and QFormLayout were added.
For an unpatched Qt 5.3, each of those automated tests will freeze as
explained in QTBUG-40609. For a fixed version, warning messages about
invalid parameters to addWidget/addLayout/... calls will be read by
QTest::ignoreMessage, resulting in a passed test.

Change-Id: I1522d5727e643da3f7c025755975aca9f482676d
Task-number: QTBUG-40609
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-09-05 00:05:45 +02:00
..
dialogs Ensure transient parents are top level widgets. 2014-07-18 09:25:05 +02:00
effects QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
graphicsview Stabilize and speed up tst_QGraphicsItem::cursor(). 2014-05-22 21:44:01 +02:00
itemviews Fix visual index lookup in QTreeViewPrivate::adjustViewOptionsForIndex(). 2014-05-06 16:35:56 +02:00
kernel Avoid adding widget to its own layout 2014-09-05 00:05:45 +02:00
styles Uncomment some tests which accidently got commented 2014-08-07 10:08:51 +02:00
util QNX: Fix QCompleter autotest 2014-04-09 20:53:06 +02:00
widgets Show the correct cursor for QLineEdit's side buttons. 2014-08-12 14:56:23 +02:00
widgets.pro Moved tests into integrationtests/ and widgets/ 2011-10-20 19:45:41 +02:00