Merge lp:~michael-sheldon/ubuntu-keyboard/fix-1398503 into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 259
Merged at revision: 258
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-1398503
Merge into: lp:ubuntu-keyboard
Diff against target: 119 lines (+10/-26)
4 files modified
plugins/westernsupport/westernlanguagefeatures.cpp (+1/-1)
src/view/abstracttexteditor.cpp (+0/-7)
tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py (+5/-5)
tests/unittests/ut_editor/ut_editor.cpp (+4/-13)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-1398503
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+243802@code.launchpad.net

Commit message

Disables automatic insertion of space characters after punctuation except when punctuation has been added by double space.

Description of the change

Disables automatic insertion of space characters after punctuation except when punctuation has been added by double space.

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-keyboard) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * No change

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
258. By Michael Sheldon

Only enter autocaps if the user has entered a space after punctuation

259. By Michael Sheldon

Update autopilot tests to account for new autocaps behaviour

Revision history for this message
Bill Filler (bfiller) wrote :

approved

review: Approve

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 2014-10-21 18:54:25 +0000
3+++ plugins/westernsupport/westernlanguagefeatures.cpp 2014-12-09 15:28:00 +0000
4@@ -60,7 +60,7 @@
5 return false;
6 }
7
8- if (sentenceBreak.contains(preedit.right(1))) {
9+ if (sentenceBreak.contains(preedit.mid(preedit.length() - 2, 1)) && preedit.right(1) == " ") {
10 return true;
11 }
12
13
14=== modified file 'src/view/abstracttexteditor.cpp'
15--- src/view/abstracttexteditor.cpp 2014-11-26 15:02:05 +0000
16+++ src/view/abstracttexteditor.cpp 2014-12-09 15:28:00 +0000
17@@ -465,10 +465,6 @@
18 // this means we should commit the candidate, add the separator and whitespace
19 d->text->setPreedit(d->text->primaryCandidate());
20 d->text->appendToPreedit(text);
21- if (d->keyboardState == "CHARACTERS" && !email_detected) {
22- d->appendix_for_previous_preedit = d->word_engine->languageFeature()->appendixForReplacedPreedit(d->text->preedit());
23- d->text->appendToPreedit(d->appendix_for_previous_preedit);
24- }
25 commitPreedit();
26 if (!email_detected) {
27 auto_caps_activated = d->word_engine->languageFeature()->activateAutoCaps(d->text->surroundingLeft() + d->text->preedit() + text);
28@@ -484,9 +480,6 @@
29 d->text->appendToPreedit(text);
30 if (!email_detected) {
31 auto_caps_activated = d->word_engine->languageFeature()->activateAutoCaps(d->text->surroundingLeft() + d->text->preedit());
32- if(isSeparator && d->keyboardState == "CHARACTERS") {
33- d->text->appendToPreedit(d->word_engine->languageFeature()->appendixForReplacedPreedit(d->text->preedit()));
34- }
35 }
36 commitPreedit();
37 alreadyAppended = true;
38
39=== modified file 'tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py'
40--- tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2014-12-02 19:24:45 +0000
41+++ tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2014-12-09 15:28:00 +0000
42@@ -316,8 +316,8 @@
43 self.assertThat(text_area.text, Eventually(Equals('abcA')))
44
45 def test_shift_state_entered_after_fullstop(self):
46- """After typing a fullstop the keyboard state must automatically
47- enter the shifted state.
48+ """After typing a fullstop followed by a space the keyboard state must
49+ automatically enter the shifted state.
50
51 """
52 text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
53@@ -325,11 +325,11 @@
54 keyboard = Keyboard()
55 self.addCleanup(keyboard.dismiss)
56
57- keyboard.type("abc.")
58+ keyboard.type("abc. ")
59
60 self.assertThat(
61 text_area.text,
62- Eventually(Equals("abc."))
63+ Eventually(Equals("abc. "))
64 )
65
66 self.assertThat(
67@@ -346,7 +346,7 @@
68 keyboard = Keyboard()
69 self.addCleanup(keyboard.dismiss)
70
71- keyboard.type("Hello my friend.\b")
72+ keyboard.type("Hello my friend. \b\b")
73
74 self.assertThat(
75 text_area.text,
76
77=== modified file 'tests/unittests/ut_editor/ut_editor.cpp'
78--- tests/unittests/ut_editor/ut_editor.cpp 2014-07-22 14:02:39 +0000
79+++ tests/unittests/ut_editor/ut_editor.cpp 2014-12-09 15:28:00 +0000
80@@ -114,9 +114,9 @@
81 // FIXME: In the current testing infra, we cannot really test this properly, as we are using the 'backspace' character
82 // a lot during auto-correction, which is currently not handled too well here.
83 QTest::newRow("auto-correct enabled, commit with space, check separators")
84- << true << "Hel ,Wor ." << "Hello , World . ";
85+ << true << "Hel , Wor ." << "Hello , World .";
86 QTest::newRow("auto-correct enabled, commit with separators, check separators")
87- << true << "Hel.Wor." << "Hello. World. ";
88+ << true << "Hel. Wor." << "Hello. World.";
89 QTest::newRow("auto-correct enabled, check if two spaces are full-stop")
90 << true << "Hel " << "Hello . ";
91 //QTest::newRow("auto-correct enabled, check removal of unnecessary whitespaces")
92@@ -183,25 +183,16 @@
93 QTest::newRow("auto-correct disabled, multiple sentences with mixed punctation")
94 << false << "This is a \"first sentence\". And a second, one! "
95 << "This is a \"first sentence\". And a second, one! " << 2;
96- QTest::newRow("auto-correct enabled, multiple sentences with mixed punctation")
97- << true << "This is a \"first sentence\".And a second,one!"
98- << "This is a \"first sentence\". And a second, one! " << 2;
99 QTest::newRow("auto-correct disabled, multiple sentences with dots")
100 << false << "First sentence. Second one. And Third. "
101 << "First sentence. Second one. And Third. " << 3;
102- QTest::newRow("auto-correct enabled, multiple sentences with dots")
103- << true << "First sentence.Second one.And Third."
104- << "First sentence. Second one. And Third. " << 3;
105
106 // Tests for the auto-correct and autocaps separator functionality
107 // FIXME: In the current testing infra, we cannot really test this properly, as we are using the 'backspace' character
108 // a lot during auto-correction, which is currently not handled too well here.
109 QTest::newRow("auto-correct enabled, autocaps after separator auto-correction")
110- << true << "Hello Wor .This should be autocapsed "
111- << "Hello World . This should be autocapsed " << 1;
112- QTest::newRow("auto-correct enabled, autocaps after separator auto-correction #2")
113- << true << "Hello Wor .This should be autocapsed "
114- << "Hello World . This should be autocapsed " << 1;
115+ << true << "Hello Wor . This should be autocapsed "
116+ << "Hello World . This should be autocapsed " << 2;
117 }
118
119 Q_SLOT void testAutoCaps()

Subscribers

People subscribed via source and target branches