Merge lp:~azzar1/unity/fix-830801 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 2298
Proposed branch: lp:~azzar1/unity/fix-830801
Merge into: lp:unity
Diff against target: 44 lines (+21/-3)
2 files modified
manual-tests/Switcher.txt (+18/-0)
plugins/unityshell/src/StaticCairoText.cpp (+3/-3)
To merge this branch: bzr merge lp:~azzar1/unity/fix-830801
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+102005@code.launchpad.net

Commit message

Fix the switcher so it displays the full title of apps in Chinese

Description of the change

== Problem ==
App Switcher (Alt+Tab) doesn't display the full title of apps in Chinese

== Fix ==
Use std::ceil to avoid this problem.

== Test ==
StaticCairoText needs a huge refactor to support unit-tests. I can add a unit-test without slowing down the code using an #ifdef TESTS_ENABLED but I don't like it too much.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> StaticCairoText needs a huge refactor to support unit-tests. I can add a unit-test without slowing down the code using > an #ifdef TESTS_ENABLED but I don't like it too much.

I don't think "huge refactor" is right here.

Probably makes more sense to split StaticCairoText into an mvc type thing, and make the view an interface so that you can mock it out in the tests.

The only other thing I can think of is the requirement for GdkScreen * to get font settings since it reads them from x propeties, but I am pretty sure this can be mocked out.

Not going to block it on this though.

Revision history for this message
Tim Penhey (thumper) wrote :

Can you explain how to test this even with a manual test?

review: Needs Information
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Can you explain how to test this even with a manual test?

Done.

Revision history for this message
Tim Penhey (thumper) :
review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

Attempt to merge into lp:unity failed due to conflicts:

text conflict in manual-tests/Switcher.txt

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Switcher.txt'
2--- manual-tests/Switcher.txt 2012-04-13 05:01:57 +0000
3+++ manual-tests/Switcher.txt 2012-04-18 07:44:19 +0000
4@@ -38,3 +38,21 @@
5 of the panel should change inline with changes in alt-tab focus.
6 Also the menus shouldn't ever show. Even if the mouse has been left over
7 the panel when starting the Alt+Tab.
8+
9+Full app title in Chinese
10+-------------------------
11+This test ensures that the App Switcher (Alt+Tab) displays the full title
12+of apps in Chinese.
13+
14+Setup:
15+#. Install gnome-tweak-tool and run it.
16+#. Make sure you have the default font scaling factor (1.0).
17+
18+Action:
19+#. Run:
20+ python -c 'from gi.repository import Gtk;win=Gtk.Window(title="显示桌面");win.connect("destroy", Gtk.main_quit);win.show_all();Gtk.main();'
21+#. Press Alt+Tab.
22+#. Continue to press Tab to select the newly created window.
23+
24+Outcome
25+ The title of the newly created window should be "显示桌面" and *not* "显示桌...".
26
27=== modified file 'plugins/unityshell/src/StaticCairoText.cpp'
28--- plugins/unityshell/src/StaticCairoText.cpp 2012-04-10 23:51:34 +0000
29+++ plugins/unityshell/src/StaticCairoText.cpp 2012-04-18 07:44:19 +0000
30@@ -377,11 +377,11 @@
31
32 // logRect has some issues using italic style
33 if (inkRect.x + inkRect.width > logRect.x + logRect.width)
34- width = (inkRect.x + inkRect.width - logRect.x) /PANGO_SCALE;
35+ width = std::ceil(static_cast<float>(inkRect.x + inkRect.width - logRect.x) / PANGO_SCALE);
36 else
37- width = logRect.width / PANGO_SCALE;
38+ width = std::ceil(static_cast<float>(logRect.width) / PANGO_SCALE);
39
40- height = logRect.height / PANGO_SCALE;
41+ height = std::ceil(static_cast<float>(logRect.height) / PANGO_SCALE);
42 _cached_extent_height = height;
43 _cached_extent_width = width;
44 _baseline = pango_layout_get_baseline(layout) / PANGO_SCALE;