on xenial help sign in
remove activeKeymapIndex, refine tests
6505fdfLukáš Tinkl
qml/Shell.qml+4−7
@@ -756,27 +756,24 @@ Item {
756
756
757 readonly property var keymaps: AccountsService.keymaps
757 readonly property var keymaps: AccountsService.keymaps
758 readonly property int keymapCount: keymaps.length
758 readonly property int keymapCount: keymaps.length
759− readonly property int activeKeymapIndex: mainAppWindow ? keymaps.indexOf(mainAppWindow.activeKeymap) : 0 // the one that the window currently has
760 property int currentKeymapIndex: 0 // the new one that we're setting
759 property int currentKeymapIndex: 0 // the new one that we're setting
761 onCurrentKeymapIndexChanged: switchToKeymap();
760 onCurrentKeymapIndexChanged: switchToKeymap();
762
761
763 function nextKeymap() {
762 function nextKeymap() {
764 var nextIndex = 0;
763 var nextIndex = 0;
765
764
766− if (activeKeymapIndex !== -1 && activeKeymapIndex < keymapCount - 1) {
765+ if (currentKeymapIndex !== -1 && currentKeymapIndex < keymapCount - 1) {
767− nextIndex = activeKeymapIndex + 1;
766+ nextIndex = currentKeymapIndex + 1;
768 }
767 }
769− print("!!! next keymap:", currentKeymapIndex, "->", nextIndex);
770 currentKeymapIndex = nextIndex;
768 currentKeymapIndex = nextIndex;
771 }
769 }
772
770
773 function previousKeymap() {
771 function previousKeymap() {
774 var prevIndex = keymapCount - 1;
772 var prevIndex = keymapCount - 1;
775
773
776− if (activeKeymapIndex > 0) {
774+ if (currentKeymapIndex > 0) {
777− prevIndex = activeKeymapIndex - 1;
775+ prevIndex = currentKeymapIndex - 1;
778 }
776 }
779− print("!!! prev keymap:", currentKeymapIndex, "->", prevIndex);
780 currentKeymapIndex = prevIndex;
777 currentKeymapIndex = prevIndex;
781 }
778 }
782
779
qml/Stages/ApplicationWindow.qml−1
@@ -28,7 +28,6 @@ FocusScope {
28 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
28 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
29 readonly property string title: sessionContainer.surface && sessionContainer.surface.name !== "" ?
29 readonly property string title: sessionContainer.surface && sessionContainer.surface.name !== "" ?
30 sessionContainer.surface.name : d.name
30 sessionContainer.surface.name : d.name
31− readonly property string activeKeymap: sessionContainer.surfaceContainer ? sessionContainer.surfaceContainer.activeKeymap : "us"
32
31
33 // overridable from outside
32 // overridable from outside
34 property bool fullscreen: application ? application.fullscreen : false
33 property bool fullscreen: application ? application.fullscreen : false
qml/Stages/SurfaceContainer.qml−2
@@ -35,8 +35,6 @@ FocusScope {
35 property int requestedWidth: -1
35 property int requestedWidth: -1
36 property int requestedHeight: -1
36 property int requestedHeight: -1
37
37
38− readonly property string activeKeymap: surface ? (surface.keymapVariant !== "" ? surface.keymapLayout + "+" + surface.keymapVariant : surface.keymapLayout)
39− : "us"
40 property string savedKeymap: AccountsService.keymaps[0] // start with the user default
38 property string savedKeymap: AccountsService.keymaps[0] // start with the user default
41
39
42 onSurfaceChanged: {
40 onSurfaceChanged: {
tests/qmltests/tst_Shell.qml+16
@@ -2321,6 +2321,22 @@ Rectangle {
2321 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2321 keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2322 tryCompare(app.session.lastSurface, "keymapLayout", "cz");
2322 tryCompare(app.session.lastSurface, "keymapLayout", "cz");
2323 tryCompare(app.session.lastSurface, "keymapVariant", "qwerty");
2323 tryCompare(app.session.lastSurface, "keymapVariant", "qwerty");
2324+
2325+ // go next twice to "sk", past the end
2326+ keyClick(Qt.Key_Space, Qt.MetaModifier);
2327+ keyClick(Qt.Key_Space, Qt.MetaModifier);
2328+ tryCompare(app.session.lastSurface, "keymapLayout", "sk");
2329+ tryCompare(app.session.lastSurface, "keymapVariant", "");
2330+
2331+ // go back once to past the beginning, to "fr"
2332+ keyClick(Qt.Key_Space, Qt.MetaModifier|Qt.ShiftModifier);
2333+ tryCompare(app.session.lastSurface, "keymapLayout", "fr");
2334+ tryCompare(app.session.lastSurface, "keymapVariant", "");
2335+
2336+ // switch to app2, should also get "fr"
2337+ ApplicationManager.requestFocusApplication("calendar-app");
2338+ tryCompare(app2.session.lastSurface, "keymapLayout", "fr");
2339+ tryCompare(app2.session.lastSurface, "keymapVariant", "");
2324 }
2340 }
2325 }
2341 }
2326}
2342}