Merge lp:~michael-sheldon/ubuntu-keyboard/fix-non-breaking-spaces into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 477
Merged at revision: 479
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-non-breaking-spaces
Merge into: lp:ubuntu-keyboard
Diff against target: 93 lines (+51/-3)
3 files modified
plugins/westernsupport/westernlanguagefeatures.cpp (+1/-1)
src/view/abstracttexteditor.cpp (+2/-2)
tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py (+48/-0)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-non-breaking-spaces
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Approve
PS Jenkins bot continuous-integration Pending
Ubuntu Phablet Team Pending
Review via email: mp+297048@code.launchpad.net

Commit message

Support all types of space character when checking for autocaps and double space full-stop insertion

Description of the change

Support all types of space character when checking for autocaps and double space full-stop insertion

To post a comment you must log in.
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:476
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-keyboard-ci/8/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/540/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/540
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/529
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/529
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/525/console
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/525/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/525
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/525/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/525
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/525/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/525
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/525/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/525
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/525/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/525
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/525/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-keyboard-ci/8/rebuild

review: Needs Fixing (continuous-integration)
477. By Michael Sheldon

Test double space full-stop insert in oxide when non-breaking spaces are present

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:477
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-keyboard-ci/19/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/599
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/73
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/599
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/569
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/569
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/563
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/563/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/563
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/563/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/563
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/563/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/563
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/563/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/563
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/563/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/563
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/563/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-keyboard-ci/19/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/westernsupport/westernlanguagefeatures.cpp'
2--- plugins/westernsupport/westernlanguagefeatures.cpp 2015-01-28 13:56:23 +0000
3+++ plugins/westernsupport/westernlanguagefeatures.cpp 2016-06-14 15:58:18 +0000
4@@ -60,7 +60,7 @@
5 return false;
6 }
7
8- if (sentenceBreak.contains(preedit.mid(preedit.length() - 2, 1)) && preedit.right(1) == " ") {
9+ if (sentenceBreak.contains(preedit.mid(preedit.length() - 2, 1)) && preedit.at(preedit.count() - 1).isSpace()) {
10 return true;
11 }
12
13
14=== modified file 'src/view/abstracttexteditor.cpp'
15--- src/view/abstracttexteditor.cpp 2016-04-27 23:37:27 +0000
16+++ src/view/abstracttexteditor.cpp 2016-06-14 15:58:18 +0000
17@@ -512,7 +512,7 @@
18 d->previous_preedit_position -= 1;
19 }
20 }
21- else if (look_for_a_double_space && not stopSequence.isEmpty() && textOnLeft.right(1) == " ") {
22+ else if (look_for_a_double_space && not stopSequence.isEmpty() && textOnLeft.at(textOnLeft.count() - 1).isSpace()) {
23 removeTrailingWhitespaces();
24 if (!d->word_engine->languageFeature()->commitOnSpace()) {
25 // Commit when inserting a fullstop if we don't insert on spaces
26@@ -870,7 +870,7 @@
27 QString::const_iterator i = textOnLeft.cend();
28 while (i != begin) {
29 --i;
30- if (*i != ' ') break;
31+ if (!i->isSpace()) break;
32 singleBackspace();
33 }
34 }
35
36=== modified file 'tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py'
37--- tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2016-04-28 00:42:26 +0000
38+++ tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2016-06-14 15:58:18 +0000
39@@ -1301,6 +1301,54 @@
40 Eventually(Equals(expected))
41 )
42
43+ def test_double_space(self):
44+ """Test that double space still inserts a full-stop and replaces all
45+ white spaces characters, even if they're non breaking spaces.
46+
47+ """
48+ qml = dedent("""
49+ import QtQuick 2.4
50+ import Ubuntu.Components 1.3
51+ import Ubuntu.Web 0.2
52+
53+ Rectangle {
54+ id: window
55+ objectName: "windowRectangle"
56+ color: "lightgrey"
57+
58+ WebView {
59+ anchors.fill: parent
60+ objectName: "webview"
61+ Component.onCompleted: {
62+ loadHtml("
63+ <html><body><textarea id='textarea'
64+ onkeyup=\\\"document.title=
65+ document.getElementById('textarea').value;\\\"
66+ style='width: 100%; height: 100%;'>&nbsp;</textarea>
67+ </body></html>"
68+ );
69+ }
70+ }
71+ }
72+
73+ """)
74+ app = self._start_qml_script(qml)
75+ webview = app.select_single(objectName='webview')
76+
77+ self.ensure_focus_on_input(webview)
78+ keyboard = Keyboard()
79+ self.addCleanup(keyboard.dismiss)
80+
81+ keyboard.type(' ')
82+
83+ # The page title trims white space, so we just look for the
84+ # full-stop, rather than '. '
85+ expected = "."
86+ self.assertThat(
87+ webview.title,
88+ Eventually(Equals(expected))
89+ )
90+
91 def test_hiding(self):
92 """Verify that the keyboard remains hidden after being dismissed from
93 a field that is no longer enabled.

Subscribers

People subscribed via source and target branches