Merge lp:~zsombi/ubuntu-ui-toolkit/im-detection-fix into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 1316
Merged at revision: 1316
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/im-detection-fix
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 118 lines (+69/-2)
5 files modified
modules/Ubuntu/Components/plugin/quickutils.cpp (+4/-1)
modules/Ubuntu/Components/plugin/quickutils.h (+1/-0)
tests/unit/tst_quickutils/tst_quickutils.cpp (+60/-0)
tests/unit/tst_quickutils/tst_quickutils.pro (+2/-0)
tests/unit/unit.pro (+2/-1)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/im-detection-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Timo Jyrinki Approve
Review via email: mp+240599@code.launchpad.net

Commit message

Ignore QT_IM_MODULE values like ibus, none or compose.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1316. By Zsombor Egri

missing .pro file added

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Looking good!!

https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-002/+sourcepub/4552364/+listing-archive-extra

i386 passed already, I'd expect amd64 and armhf to successfully finish as well.

review: Approve
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/plugin/quickutils.cpp'
2--- modules/Ubuntu/Components/plugin/quickutils.cpp 2014-08-12 10:58:30 +0000
3+++ modules/Ubuntu/Components/plugin/quickutils.cpp 2014-11-05 07:48:25 +0000
4@@ -35,6 +35,7 @@
5 m_rootView(0)
6 {
7 QGuiApplication::instance()->installEventFilter(this);
8+ m_omitIM << "ibus" << "none" << "compose";
9 }
10
11 /*!
12@@ -107,7 +108,9 @@
13
14 QString QuickUtils::inputMethodProvider() const
15 {
16- return QString(getenv("QT_IM_MODULE"));
17+ QString im(getenv("QT_IM_MODULE"));
18+
19+ return m_omitIM.contains(im) ? QString() : im;
20 }
21
22 bool QuickUtils::touchScreenAvailable() const
23
24=== modified file 'modules/Ubuntu/Components/plugin/quickutils.h'
25--- modules/Ubuntu/Components/plugin/quickutils.h 2014-06-10 11:47:09 +0000
26+++ modules/Ubuntu/Components/plugin/quickutils.h 2014-11-05 07:48:25 +0000
27@@ -58,6 +58,7 @@
28 private:
29 explicit QuickUtils(QObject *parent = 0);
30 QPointer<QQuickView> m_rootView;
31+ QStringList m_omitIM;
32
33 void lookupQuickView();
34 };
35
36=== added directory 'tests/unit/tst_quickutils'
37=== added file 'tests/unit/tst_quickutils/tst_quickutils.cpp'
38--- tests/unit/tst_quickutils/tst_quickutils.cpp 1970-01-01 00:00:00 +0000
39+++ tests/unit/tst_quickutils/tst_quickutils.cpp 2014-11-05 07:48:25 +0000
40@@ -0,0 +1,60 @@
41+/*
42+ * Copyright 2014 Canonical Ltd.
43+ *
44+ * This program is free software; you can redistribute it and/or modify
45+ * it under the terms of the GNU Lesser General Public License as published by
46+ * the Free Software Foundation; version 3.
47+ *
48+ * This program is distributed in the hope that it will be useful,
49+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
50+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51+ * GNU Lesser General Public License for more details.
52+ *
53+ * You should have received a copy of the GNU Lesser General Public License
54+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
55+ *
56+ */
57+
58+#include "uctestcase.h"
59+#include "quickutils.h"
60+
61+class tst_QuickUtils : public QObject
62+{
63+ Q_OBJECT
64+public:
65+ tst_QuickUtils() {}
66+
67+private:
68+ QString imEnvVar;
69+
70+private Q_SLOTS:
71+ void initTestCase()
72+ {
73+ imEnvVar = qgetenv("QT_IM_MODULE");
74+ QuickUtils::instance();
75+ }
76+ void cleanupTestCase()
77+ {
78+ qputenv("QT_IM_MODULE", imEnvVar.toLocal8Bit());
79+ }
80+
81+ void test_inputmethod_data()
82+ {
83+ QTest::addColumn<QByteArray>("envVar");
84+
85+ QTest::newRow("(empty)") << QByteArray("");
86+ QTest::newRow("ibus") << QByteArray("ibus");
87+ QTest::newRow("compose") << QByteArray("compose");
88+ QTest::newRow("none") << QByteArray("none");
89+ }
90+ void test_inputmethod()
91+ {
92+ QFETCH(QByteArray, envVar);
93+ qputenv("QT_IM_MODULE", envVar);
94+ QVERIFY(QuickUtils::instance().inputMethodProvider().isEmpty());
95+ }
96+};
97+
98+QTEST_MAIN(tst_QuickUtils)
99+
100+#include "tst_quickutils.moc"
101
102=== added file 'tests/unit/tst_quickutils/tst_quickutils.pro'
103--- tests/unit/tst_quickutils/tst_quickutils.pro 1970-01-01 00:00:00 +0000
104+++ tests/unit/tst_quickutils/tst_quickutils.pro 2014-11-05 07:48:25 +0000
105@@ -0,0 +1,2 @@
106+include(../test-include.pri)
107+SOURCES += tst_quickutils.cpp
108
109=== modified file 'tests/unit/unit.pro'
110--- tests/unit/unit.pro 2014-06-09 08:26:24 +0000
111+++ tests/unit/unit.pro 2014-11-05 07:48:25 +0000
112@@ -23,4 +23,5 @@
113 tst_arguments \
114 tst_argument \
115 tst_alarms \
116- tst_theme
117+ tst_theme \
118+ tst_quickutils

Subscribers

People subscribed via source and target branches