diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-17 10:46:42 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-12-21 16:47:55 +0000 |
commit | 8099ecb2a73832b930d217e7a957f190d49e6eb1 (patch) | |
tree | a85be2bc15760472e298788de23c14c930ee53ac /tests | |
parent | c34e39cd1fd078510467536a9562e365cdae4d8f (diff) |
Control: implement locale inheritance
Change-Id: I2f16141b53dd44e471050ef6901ddc480c77895f
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_control.qml | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml index ea1e58df..7fe61064 100644 --- a/tests/auto/controls/data/tst_control.qml +++ b/tests/auto/controls/data/tst_control.qml @@ -639,6 +639,191 @@ TestCase { control.destroy() } + Component { + id: component5 + T.Control { + id: item2 + objectName: "item2" + property alias localespy: _lspy; + property alias mirroredspy: _mspy; + property alias localespy_2: _lspy_2; + property alias mirroredspy_2: _mspy_2; + property alias localespy_3: _lspy_3; + property alias mirroredspy_3: _mspy_3; + property alias item2_2: _item2_2; + property alias item2_3: _item2_3; + T.Control { + id: _item2_2 + objectName: "_item2_2" + T.Control { + id: _item2_3 + objectName: "_item2_3" + + SignalSpy { + id: _lspy_3 + target: item2_3 + signalName: "localeChanged" + } + + SignalSpy { + id: _mspy_3 + target: item2_3 + signalName: "mirroredChanged" + } + } + + SignalSpy { + id: _lspy_2 + target: item2_2 + signalName: "localeChanged" + } + + SignalSpy { + id: _mspy_2 + target: item2_2 + signalName: "mirroredChanged" + } + } + + SignalSpy { + id: _lspy + target: item2 + signalName: "localeChanged" + } + + SignalSpy { + id: _mspy + target: item2 + signalName: "mirroredChanged" + } + } + } + + function test_locale_2() { + var control = component5.createObject(testCase) + verify(control) + verify(control.item2_2) + verify(control.item2_3) + + var defaultLocale = Qt.locale() + + compare(control.locale.name, defaultLocale.name) + compare(control.item2_2.locale.name, defaultLocale.name) + compare(control.item2_3.locale.name, defaultLocale.name) + + control.locale = Qt.locale("nb_NO") + control.localespy.wait() + compare(control.localespy.count, 1) + compare(control.mirroredspy.count, 0) + compare(control.locale.name, "nb_NO") + compare(control.item2_2.locale.name, "nb_NO") + compare(control.item2_3.locale.name, "nb_NO") + compare(control.localespy_2.count, 1) + compare(control.mirroredspy_2.count, 0) + compare(control.localespy_3.count, 1) + compare(control.mirroredspy_3.count, 0) + + control.locale = Qt.locale("ar_EG") + control.localespy.wait() + compare(control.localespy.count, 2) + compare(control.mirroredspy.count, 1) + compare(control.locale.name, "ar_EG") + compare(control.item2_2.locale.name, "ar_EG") + compare(control.item2_3.locale.name, "ar_EG") + compare(control.localespy_2.count, 2) + compare(control.mirroredspy_2.count, 1) + compare(control.localespy_3.count, 2) + compare(control.mirroredspy_3.count, 1) + } + + Component { + id: component6 + T.Control { + id: item6 + objectName: "item6" + property alias localespy: _lspy; + property alias mirroredspy: _mspy; + property alias localespy_5: _lspy_5; + property alias mirroredspy_5: _mspy_5; + property alias item6_2: _item6_2; + property alias item6_3: _item6_3; + property alias item6_4: _item6_4; + property alias item6_5: _item6_5; + Item { + id: _item6_2 + objectName: "_item6_2" + T.Control { + id: _item6_3 + objectName: "_item6_3" + Item { + id: _item6_4 + objectName: "_item6_4" + T.Control { + id: _item6_5 + objectName: "_item6_5" + + SignalSpy { + id: _lspy_5 + target: _item6_5 + signalName: "localeChanged" + } + + SignalSpy { + id: _mspy_5 + target: _item6_5 + signalName: "mirroredChanged" + } + } + } + } + } + + SignalSpy { + id: _lspy + target: item6 + signalName: "localeChanged" + } + + SignalSpy { + id: _mspy + target: item6 + signalName: "mirroredChanged" + } + } + } + + function test_locale_3() { + var control = component6.createObject(testCase) + verify(control) + verify(control.item6_2) + verify(control.item6_3) + verify(control.item6_4) + verify(control.item6_5) + + var defaultLocale = Qt.locale() + + compare(control.locale.name, defaultLocale.name) + compare(control.item6_5.locale.name, defaultLocale.name) + + control.locale = Qt.locale("nb_NO") + control.localespy.wait() + compare(control.localespy.count, 1) + compare(control.mirroredspy.count, 0) + compare(control.locale.name, "nb_NO") + compare(control.item6_5.locale.name, "nb_NO") + compare(control.localespy_5.count, 1) + compare(control.mirroredspy_5.count, 0) + + control.locale = Qt.locale("ar_EG") + control.localespy.wait() + compare(control.localespy.count, 2) + compare(control.mirroredspy.count, 1) + compare(control.locale.name, "ar_EG") + compare(control.item6_5.locale.name, "ar_EG") + compare(control.localespy_5.count, 2) + compare(control.mirroredspy_5.count, 1) + } + function test_focusReason_data() { return [ { tag: "Control", qml: "import Qt.labs.controls 1.0; Control { }" }, |