diff options
author | Liang Qi <liang.qi@qt.io> | 2017-03-28 09:23:03 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-03-28 09:28:31 +0200 |
commit | b48a13fd6843e12b5725aa3ff0d010007e7c43b4 (patch) | |
tree | 316cfe36fc67906efcd92ff806c7c0da56ed4f8e /tests/auto/widgets/kernel | |
parent | 3398d9d40cb0dae2dc2a1a4f7dc3b4b9cceae903 (diff) | |
parent | 15fe60cfdada84ea519f08e905d59cc3fb6d20cd (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
examples/examples.pro
tests/auto/corelib/tools/qchar/tst_qchar.cpp
tests/auto/other/qaccessibility/accessiblewidgets.h
Change-Id: I426696c40ab57d14dc295b8103152cede79f244c
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index cd1df49f8c..5fe0232d90 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -277,6 +277,7 @@ private slots: #endif void setLocale(); + void propagateLocale(); void deleteStyle(); void multipleToplevelFocusCheck(); void setFocus(); @@ -1205,6 +1206,33 @@ void tst_QWidget::setLocale() QCOMPARE(child2.locale(), QLocale(QLocale::French)); } +void tst_QWidget::propagateLocale() +{ + QWidget parent; + parent.setLocale(QLocale::French); + // Non-window widget; propagates locale: + QWidget *child = new QWidget(&parent); + QVERIFY(!child->isWindow()); + QVERIFY(!child->testAttribute(Qt::WA_WindowPropagation)); + QCOMPARE(child->locale(), QLocale(QLocale::French)); + parent.setLocale(QLocale::Italian); + QCOMPARE(child->locale(), QLocale(QLocale::Italian)); + delete child; + // Window: doesn't propagate locale: + child = new QWidget(&parent, Qt::Window); + QVERIFY(child->isWindow()); + QVERIFY(!child->testAttribute(Qt::WA_WindowPropagation)); + QCOMPARE(child->locale(), QLocale()); + parent.setLocale(QLocale::French); + QCOMPARE(child->locale(), QLocale()); + // ... unless we tell it to: + child->setAttribute(Qt::WA_WindowPropagation, true); + QVERIFY(child->testAttribute(Qt::WA_WindowPropagation)); + QCOMPARE(child->locale(), QLocale(QLocale::French)); + parent.setLocale(QLocale::Italian); + QCOMPARE(child->locale(), QLocale(QLocale::Italian)); +} + void tst_QWidget::visible_setWindowOpacity() { QScopedPointer<QWidget> testWidget(new QWidget); |