on xenial help sign in
fix showing hiding the indicator icon and some failing tests
d7a2d01Lukáš Tinkl
qml/Panel/Panel.qml+3−5
@@ -23,8 +23,6 @@ import Utils 0.1
23import Unity.ApplicationMenu 0.1
23import Unity.ApplicationMenu 0.1
24
24
25import QtQuick.Window 2.2
25import QtQuick.Window 2.2
26−// for indicator-keyboard
27−import AccountsService 0.1
28
26
29import "../ApplicationMenus"
27import "../ApplicationMenus"
30import "../Components"
28import "../Components"
@@ -335,12 +333,12 @@ Item {
335 objectName: identifier+"-panelItem"
333 objectName: identifier+"-panelItem"
336
334
337 property int ownIndex: index
335 property int ownIndex: index
338− property bool overflow: parent.width - x > __indicators.overFlowWidth
336+ readonly property bool overflow: parent.width - x > __indicators.overFlowWidth
339− property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator || hideKeyboardIndicator)
337+ readonly property bool hidden: !expanded && (overflow || !indicatorVisible || hideSessionIndicator || hideKeyboardIndicator)
340 // HACK for indicator-session
338 // HACK for indicator-session
341 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
339 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
342 // HACK for indicator-keyboard
340 // HACK for indicator-keyboard
343− readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && AccountsService.keymaps.length < 2 && !hasKeyboard
341+ readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && !hasKeyboard
344
342
345 height: parent.height
343 height: parent.height
346 expanded: indicators.expanded
344 expanded: indicators.expanded
tests/qmltests/Panel/tst_Panel.qml+4−2
@@ -272,6 +272,7 @@ PanelTest {
272 }
272 }
273
273
274 function cleanup() {
274 function cleanup() {
275+ panel.hasKeyboard = false;
275 panel.indicators.hide();
276 panel.indicators.hide();
276 panel.applicationMenus.hide();
277 panel.applicationMenus.hide();
277 waitForAllAnimationToComplete("initial");
278 waitForAllAnimationToComplete("initial");
@@ -713,8 +714,8 @@ PanelTest {
713 { tag: "No keyboard, no keymap", keyboard: false, keymaps: [], hidden: true },
714 { tag: "No keyboard, no keymap", keyboard: false, keymaps: [], hidden: true },
714 { tag: "No keyboard, one keymap", keyboard: false, keymaps: ["us"], hidden: true },
715 { tag: "No keyboard, one keymap", keyboard: false, keymaps: ["us"], hidden: true },
715 { tag: "No keyboard, 2 keymaps", keyboard: false, keymaps: ["us", "cs"], hidden: true },
716 { tag: "No keyboard, 2 keymaps", keyboard: false, keymaps: ["us", "cs"], hidden: true },
716− { tag: "Keyboard, no keymap", keyboard: true, keymaps: [], hidden: true },
717+ { tag: "Keyboard, no keymap", keyboard: true, keymaps: [], hidden: false },
717− { tag: "Keyboard, one keymap", keyboard: true, keymaps: ["us"], hidden: true },
718+ { tag: "Keyboard, one keymap", keyboard: true, keymaps: ["us"], hidden: false },
718 { tag: "Keyboard, 2 keymaps", keyboard: true, keymaps: ["us", "cs"], hidden: false }
719 { tag: "Keyboard, 2 keymaps", keyboard: true, keymaps: ["us", "cs"], hidden: false }
719 ];
720 ];
720 }
721 }
@@ -722,6 +723,7 @@ PanelTest {
722 function test_hidingKeyboardIndicator(data) {
723 function test_hidingKeyboardIndicator(data) {
723 var item = findChild(panel, "indicator-keyboard-panelItem");
724 var item = findChild(panel, "indicator-keyboard-panelItem");
724 AccountsService.keymaps = data.keymaps;
725 AccountsService.keymaps = data.keymaps;
726+ panel.hasKeyboard = data.keyboard;
725 if (data.keyboard) {
727 if (data.keyboard) {
726 MockInputDeviceBackend.addMockDevice("/indicator_kbd0", InputInfo.Keyboard);
728 MockInputDeviceBackend.addMockDevice("/indicator_kbd0", InputInfo.Keyboard);
727 } else {
729 } else {
tests/qmltests/tst_OrientedShell.qml−2
@@ -1045,7 +1045,6 @@ Rectangle {
1045
1045
1046 tryCompare(shell, "usageScenario", "phone");
1046 tryCompare(shell, "usageScenario", "phone");
1047 tryCompare(inputMethod, "enabled", true);
1047 tryCompare(inputMethod, "enabled", true);
1048− tryCompare(oskSettings, "disableHeight", false);
1049
1048
1050 if (data.kbd) {
1049 if (data.kbd) {
1051 MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
1050 MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
@@ -1056,7 +1055,6 @@ Rectangle {
1056
1055
1057 tryCompare(shell, "usageScenario", data.expectedMode);
1056 tryCompare(shell, "usageScenario", data.expectedMode);
1058 tryCompare(inputMethod, "enabled", data.oskExpected);
1057 tryCompare(inputMethod, "enabled", data.oskExpected);
1059− tryCompare(oskSettings, "disableHeight", data.expectedMode == "desktop" || data.kbd);
1060
1058
1061 // Restore width
1059 // Restore width
1062 orientedShellLoader.width = oldWidth;
1060 orientedShellLoader.width = oldWidth;