Merge lp:~zsombi/ubuntu-ui-toolkit/textinput-pageupdown-fix into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Cris Dywan
Approved revision: 1037
Merged at revision: 1038
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/textinput-pageupdown-fix
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~zsombi/ubuntu-ui-toolkit/textinput-carets
Diff against target: 137 lines (+79/-2)
4 files modified
modules/Ubuntu/Components/InputHandler.qml (+29/-0)
modules/Ubuntu/Components/TextArea.qml (+2/-1)
modules/Ubuntu/Components/TextField.qml (+2/-1)
tests/unit_x11/tst_components/tst_textinput_common.qml (+46/-0)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/textinput-pageupdown-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+218053@code.launchpad.net

Commit message

PageUp/PageDown fix in text inputs.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1035
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/159/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/572
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/5198
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-amd64-ci/159
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/159
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-armhf-ci/159/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-trusty-i386-ci/159
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/498
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4866
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4866/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6701
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4464
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5421
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5421/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/159/rebuild

review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Shift+ would be nice to test in the unit tests if possible, it's the same movement but also makes the selection - it works as-is, just absent from test_input_pageup_pagedown.

review: Needs Fixing
Revision history for this message
Cris Dywan (kalikiana) wrote :

Thanks a bunch!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1037
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/178/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/51
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/44
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/10
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/10
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/10/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/10
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/562
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/147
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/147/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6873
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/44
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/71
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/71/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/178/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/InputHandler.qml'
2--- modules/Ubuntu/Components/InputHandler.qml 2014-05-06 12:15:15 +0000
3+++ modules/Ubuntu/Components/InputHandler.qml 2014-05-07 09:18:04 +0000
4@@ -209,6 +209,26 @@
5 }
6 }
7
8+ // moves the cursor one page forward with or without positioning the cursor
9+ function movePage(forward) {
10+ var cx = input.cursorRectangle.x;
11+ var cy = input.cursorRectangle.y;
12+ if (forward) {
13+ if (singleLine) {
14+ cx += visibleArea.width;
15+ } else {
16+ cy += visibleArea.height;
17+ }
18+ } else {
19+ if (singleLine) {
20+ cx -= visibleArea.width;
21+ } else {
22+ cy -= visibleArea.height;
23+ }
24+ }
25+ input.cursorPosition = cursorPosition(cx, cy);
26+ }
27+
28 Component.onCompleted: {
29 state = (main.focus) ? "" : "inactive";
30 }
31@@ -301,6 +321,15 @@
32 }
33 }
34
35+ // PageUp and PageDown handling
36+ Keys.onPressed: {
37+ if (event.key === Qt.Key_PageUp && event.modifiers === Qt.NoModifier) {
38+ movePage(false);
39+ } else if (event.key === Qt.Key_PageDown && event.modifiers === Qt.NoModifier) {
40+ movePage(true);
41+ }
42+ }
43+
44 // Mouse handling
45 Mouse.forwardTo: [main]
46 Mouse.onPressed: {
47
48=== modified file 'modules/Ubuntu/Components/TextArea.qml'
49--- modules/Ubuntu/Components/TextArea.qml 2014-04-30 07:10:06 +0000
50+++ modules/Ubuntu/Components/TextArea.qml 2014-05-07 09:18:04 +0000
51@@ -860,7 +860,8 @@
52 selectionColor: Theme.palette.selected.foreground
53 font.pixelSize: FontUtils.sizeToPixels("medium")
54 // forward keys to the root element so it can be captured outside of it
55- Keys.forwardTo: [control]
56+ // as well as to InputHandler to handle PageUp/PageDown keys
57+ Keys.forwardTo: [control, inputHandler]
58
59 // autosize handling
60 onLineCountChanged: internal.frameSize()
61
62=== modified file 'modules/Ubuntu/Components/TextField.qml'
63--- modules/Ubuntu/Components/TextField.qml 2014-05-02 07:22:52 +0000
64+++ modules/Ubuntu/Components/TextField.qml 2014-05-07 09:18:04 +0000
65@@ -989,7 +989,8 @@
66 font.pixelSize: FontUtils.sizeToPixels("medium")
67 passwordCharacter: "\u2022"
68 // forward keys to the root element so it can be captured outside of it
69- Keys.forwardTo: [control]
70+ // as well as to InputHandler to handle PageUp/PageDown keys
71+ Keys.forwardTo: [control, inputHandler]
72
73 // overrides
74 selectByMouse: false
75
76=== modified file 'tests/unit_x11/tst_components/tst_textinput_common.qml'
77--- tests/unit_x11/tst_components/tst_textinput_common.qml 2014-05-02 07:22:52 +0000
78+++ tests/unit_x11/tst_components/tst_textinput_common.qml 2014-05-07 09:18:04 +0000
79@@ -86,6 +86,7 @@
80 popupSpy.clear();
81 movementXSpy.clear();
82 movementYSpy.clear();
83+ cursorRectSpy.clear();
84 }
85
86 function test_textfield_grab_caret_data() {
87@@ -194,5 +195,50 @@
88 mouseClick(testMain, testMain.width / 2, testMain.height / 2);
89 wait(200);
90 }
91+
92+ SignalSpy {
93+ id: cursorRectSpy
94+ signalName: "cursorRectangleChanged"
95+ }
96+
97+ function test_input_pageup_pagedown_data() {
98+ return [
99+ {tag: "PageUp in TextField", input: textField, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.NoModifier, xfail: false},
100+ {tag: "PageDown in TextField", input: textField, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.NoModifier, xfail: false},
101+ {tag: "PageUp in TextArea", input: textArea, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.NoModifier, xfail: false},
102+ {tag: "PageDown in TextArea", input: textArea, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.NoModifier, xfail: false},
103+ {tag: "Ctrl+PageUp in TextField", input: textField, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.ControlModifier, xfail: true},
104+ {tag: "Ctrl+PageDown in TextField", input: textField, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.ControlModifier, xfail: true},
105+ {tag: "Ctrl+PageUp in TextArea", input: textArea, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.ControlModifier, xfail: true},
106+ {tag: "Ctrl+PageDown in TextArea", input: textArea, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.ControlModifier, xfail: true},
107+ {tag: "Shift+PageUp in TextField", input: textField, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.ShiftModifier, xfail: true},
108+ {tag: "Shift+PageDown in TextField", input: textField, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.ShiftModifier, xfail: true},
109+ {tag: "Shift+PageUp in TextArea", input: textArea, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.ShiftModifier, xfail: true},
110+ {tag: "Shift+PageDown in TextArea", input: textArea, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.ShiftModifier, xfail: true},
111+ {tag: "Alt+PageUp in TextField", input: textField, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.AltModifier, xfail: true},
112+ {tag: "Alt+PageDown in TextField", input: textField, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.AltModifier, xfail: true},
113+ {tag: "Alt+PageUp in TextArea", input: textArea, moveToEnd: true, key: Qt.Key_PageUp, modifier: Qt.AltModifier, xfail: true},
114+ {tag: "Alt+PageDown in TextArea", input: textArea, moveToEnd: false, key: Qt.Key_PageDown, modifier: Qt.AltModifier, xfail: true},
115+ ];
116+ }
117+ function test_input_pageup_pagedown(data) {
118+ var handler = findChild(data.input, "input_handler");
119+ data.input.focus = true;
120+
121+ // move the cursor to the end
122+ if (data.moveToEnd) {
123+ keyClick(Qt.Key_End);
124+ waitForRendering(data.input, 500);
125+ verify(data.input.cursorPosition > 0, "The cursor wasn't moved");
126+ }
127+ cursorRectSpy.target = data.input;
128+ keyClick(data.key, data.modifier);
129+ waitForRendering(data.input, 500);
130+ if (data.xfail) {
131+ expectFailContinue(data.tag, "With modifier");
132+ }
133+ cursorRectSpy.wait(500);
134+ cursorRectSpy.target = null;
135+ }
136 }
137 }

Subscribers

People subscribed via source and target branches