Merge lp:~unity-2d-team/unity-2d/unity-2d-dash-fullscreen-via-dconf into lp:unity-2d
- unity-2d-dash-fullscreen-via-dconf
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Florian Boucault |
Approved revision: | 871 |
Merged at revision: | 874 |
Proposed branch: | lp:~unity-2d-team/unity-2d/unity-2d-dash-fullscreen-via-dconf |
Merge into: | lp:unity-2d |
Diff against target: |
465 lines (+197/-110) 8 files modified
config.h.in (+6/-0) data/com.canonical.Unity2d.gschema.xml (+10/-0) libunity-2d-private/Unity2d/plugin.cpp (+3/-0) libunity-2d-private/src/dashsettings.cpp (+2/-59) libunity-2d-private/src/dashsettings.h (+1/-25) panel/applets/appname/windowhelper.cpp (+5/-20) places/dash.qml (+2/-6) tests/places/fullscreen.rb (+168/-0) |
To merge this branch: | bzr merge lp:~unity-2d-team/unity-2d/unity-2d-dash-fullscreen-via-dconf |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Florian Boucault (community) | Needs Fixing | ||
Review via email: mp+89867@code.launchpad.net |
Commit message
Description of the change
[dash][panel] Use a new dash-specific dconf key to store the dash fullscreen state instead of using a wrongly named 3d key
Florian Boucault (fboucault) wrote : | # |
Florian Boucault (fboucault) wrote : | # |
Let's add the following automated tests to the mix:
17:57 < Kaleo> nerochiaro: 1st test: depending on the dconf key making sure the maximisation state is respected
17:57 < Kaleo> nerochiaro: 2nd test: clicking on the maximise button in the panel; making sure the dash reacts properly
17:58 < nerochiaro> Kaleo: also bring out the dash, change dconf key, check dash has changed state properly
Florian Boucault (fboucault) wrote : | # |
kaleo@tequila:
unity-2d-places: [WARNING] Object::connect: No such signal DashDeclarative
unity-2d-places: [WARNING] file://
value: return dash2dConfigura
Florian Boucault (fboucault) wrote : | # |
The following change does not belong in this merge request.
=== modified file places/
--- places/
+++ places/
@@ -159,7 +159,6 @@
if (value != m_active) {
m_active = value;
if (value) {
- updateDashModeD
// We need a delay, otherwise the window may not be visible when we try to activate it
Florian Boucault (fboucault) wrote : | # |
Apart from all the comments above, the rest of the code looks great. Manual functional testing showed no new issue.
Ugo Riboni (uriboni) wrote : | # |
Fixed the error, and pushed the tests.
The commit that you say doesn't belong actually does belong: we need to remove the call to updateDashModeD
Florian Boucault (fboucault) wrote : | # |
> Fixed the error, and pushed the tests.
> The commit that you say doesn't belong actually does belong: we need to remove
> the call to updateDashModeD
> activate the dash it will override whatever fullscreen value we read from
> dconf (via the binding in QML).
Yes but that was already the case in trunk wasn't it? Fixing that is really better done in [1] because in there you change the way monitoring the screen's resolution is done [2] which is completely related to the line of code in question.
[1] https:/
[2] + connect(
Florian Boucault (fboucault) wrote : | # |
The tests verify that the dashMode is set properly. It sounds of little use compared to actually checking the size of the dash.
Florian Boucault (fboucault) wrote : | # |
btw, you will need a test case for what mentioned:
"otherwise every time we activate the dash it will override whatever fullscreen value we read from dconf"
Ugo Riboni (uriboni) wrote : | # |
I ended up agreeing with pretty much all your comments, therefore the following changes were made:
- Put back the call to updateDashModeD
- Added a test which verifies this overriding
Ugo Riboni (uriboni) wrote : | # |
> The tests verify that the dashMode is set properly. It sounds of little use
> compared to actually checking the size of the dash.
The one thing I don't agree with you is this. I think it's more than sufficient to check DashMode, because it's directly tied in QML to dash size and I didn't touch that part at all in this MR.
However if you insist I think that what may be useful is adding just one single test, separate from this MR, which sets a dashMode and tests the size, then sets the other dashMode and tests the size.
It's all it's needed, because the tests in this MR check that dashMode is set to the right value, but trust dashMode to work fine in setting the size. And the other test I propose adding would test that the size is set correctly based on DashMode.
Keep in mind though that the tests for shaping that are in the shell branch will do exactly these kinds of tests, so it all feels quite redundant.
Florian Boucault (fboucault) wrote : | # |
> > The tests verify that the dashMode is set properly. It sounds of little use
> > compared to actually checking the size of the dash.
>
> The one thing I don't agree with you is this. I think it's more than
> sufficient to check DashMode, because it's directly tied in QML to dash size
> and I didn't touch that part at all in this MR.
>
> However if you insist I think that what may be useful is adding just one
> single test, separate from this MR, which sets a dashMode and tests the size,
> then sets the other dashMode and tests the size.
> It's all it's needed, because the tests in this MR check that dashMode is set
> to the right value, but trust dashMode to work fine in setting the size. And
> the other test I propose adding would test that the size is set correctly
> based on DashMode.
>
> Keep in mind though that the tests for shaping that are in the shell branch
> will do exactly these kinds of tests, so it all feels quite redundant.
If we have tests down the line that will do it, then we are good.
Unity Merger (unity-merger) wrote : | # |
The Jenkins job https:/
Not merging it.
Preview Diff
1 | === modified file 'config.h.in' |
2 | --- config.h.in 2011-12-07 19:20:54 +0000 |
3 | +++ config.h.in 2012-01-26 18:08:30 +0000 |
4 | @@ -11,6 +11,7 @@ |
5 | static const char* UNITY2D_DCONF_SCHEMA = "com.canonical.Unity2d"; |
6 | static const char* LAUNCHER2D_DCONF_SCHEMA = "com.canonical.Unity2d.Launcher"; |
7 | static const char* PANEL2D_DCONF_SCHEMA = "com.canonical.Unity2d.Panel"; |
8 | +static const char* DASH2D_DCONF_SCHEMA = "com.canonical.Unity2d.Dash"; |
9 | |
10 | static const char* UNITY_DCONF_SCHEMA = "com.canonical.Unity"; |
11 | static const char* LAUNCHER_DCONF_SCHEMA = "com.canonical.Unity.Launcher"; |
12 | @@ -31,6 +32,11 @@ |
13 | return configuration; |
14 | } |
15 | |
16 | +inline QConf& dash2dConfiguration() { |
17 | + static QConf configuration(DASH2D_DCONF_SCHEMA); |
18 | + return configuration; |
19 | +} |
20 | + |
21 | inline QConf& unityConfiguration() { |
22 | static QConf configuration(UNITY_DCONF_SCHEMA); |
23 | return configuration; |
24 | |
25 | === modified file 'data/com.canonical.Unity2d.gschema.xml' |
26 | --- data/com.canonical.Unity2d.gschema.xml 2011-12-01 09:55:45 +0000 |
27 | +++ data/com.canonical.Unity2d.gschema.xml 2012-01-26 18:08:30 +0000 |
28 | @@ -36,4 +36,14 @@ |
29 | </description> |
30 | </key> |
31 | </schema> |
32 | + <schema path="/com/canonical/unity-2d/dash/" id="com.canonical.Unity2d.Dash" gettext-domain="unity-2d"> |
33 | + <key type="b" name="full-screen"> |
34 | + <default>false</default> |
35 | + <summary>The current fullscreen status of the dash</summary> |
36 | + <description> |
37 | + Describe if the dash should be fullscreen or not. If the dash is already running this setting |
38 | + is applied immediately, otherwise it is applied as soon as the dash is activated again. |
39 | + </description> |
40 | + </key> |
41 | + </schema> |
42 | </schemalist> |
43 | |
44 | === modified file 'libunity-2d-private/Unity2d/plugin.cpp' |
45 | --- libunity-2d-private/Unity2d/plugin.cpp 2012-01-19 14:35:41 +0000 |
46 | +++ libunity-2d-private/Unity2d/plugin.cpp 2012-01-26 18:08:30 +0000 |
47 | @@ -179,6 +179,9 @@ |
48 | engine->rootContext()->setContextProperty("screen", ScreenInfo::instance()); |
49 | engine->rootContext()->setContextProperty("iconUtilities", new IconUtilities(engine)); |
50 | |
51 | + /* Expose QConf objects as a context property not to initialize it multiple times */ |
52 | + engine->rootContext()->setContextProperty("dash2dConfiguration", &dash2dConfiguration()); |
53 | + |
54 | /* Critically important to set the client type to pager because wnck |
55 | will pass that type over to the window manager through XEvents. |
56 | Window managers tend to respect orders from pagers to the letter by |
57 | |
58 | === modified file 'libunity-2d-private/src/dashsettings.cpp' |
59 | --- libunity-2d-private/src/dashsettings.cpp 2011-12-09 09:14:11 +0000 |
60 | +++ libunity-2d-private/src/dashsettings.cpp 2012-01-26 18:08:30 +0000 |
61 | @@ -21,73 +21,16 @@ |
62 | // Self |
63 | #include "dashsettings.h" |
64 | |
65 | -// Local |
66 | - |
67 | -// Qt |
68 | -#include <QMetaEnum> |
69 | -#include <QSize> |
70 | -#include <QVariant> |
71 | - |
72 | #include <config.h> |
73 | |
74 | static const int DASH_MIN_SCREEN_WIDTH = 1280; |
75 | static const int DASH_MIN_SCREEN_HEIGHT = 1084; |
76 | |
77 | -static const char* FORM_FACTOR = "formFactor"; |
78 | - |
79 | namespace Unity2d { |
80 | |
81 | -class DashSettingsPrivate |
82 | -{ |
83 | - DashSettingsPrivate(DashSettings *dashSettings) |
84 | - { |
85 | - /* proxy the formFactor property signal notifier */ |
86 | - QObject::connect(&unityConfiguration(), SIGNAL(formFactorChanged(QString)), |
87 | - dashSettings, SIGNAL(formFactorChanged())); |
88 | - |
89 | - /* Get the QMetaEnum for FormFactor: we will use it when setting and |
90 | - * getting the property, to convert the string value returned by QConf |
91 | - * to an enum value, and vice versa. */ |
92 | - const QMetaObject *metaObject = dashSettings->metaObject(); |
93 | - int index = metaObject->indexOfEnumerator("FormFactor"); |
94 | - formFactorEnum = metaObject->enumerator(index); |
95 | - } |
96 | - |
97 | - ~DashSettingsPrivate() |
98 | - { |
99 | - } |
100 | - |
101 | -private: |
102 | - DashSettings* q_ptr; |
103 | - Q_DECLARE_PUBLIC(DashSettings) |
104 | - |
105 | - QMetaEnum formFactorEnum; |
106 | -}; |
107 | - |
108 | DashSettings::DashSettings(QObject* parent): |
109 | - QObject(parent), |
110 | - d_ptr(new DashSettingsPrivate(this)) |
111 | -{ |
112 | -} |
113 | - |
114 | -DashSettings::~DashSettings() |
115 | -{ |
116 | - delete d_ptr; |
117 | -} |
118 | - |
119 | -void DashSettings::setFormFactor(FormFactor formFactor) |
120 | -{ |
121 | - Q_D(DashSettings); |
122 | - |
123 | - const char* name = d->formFactorEnum.valueToKey(formFactor); |
124 | - unityConfiguration().setProperty(FORM_FACTOR, QVariant(QString::fromLatin1(name))); |
125 | -} |
126 | - |
127 | -DashSettings::FormFactor DashSettings::formFactor() const |
128 | -{ |
129 | - Q_D(const DashSettings); |
130 | - QByteArray key = unityConfiguration().property(FORM_FACTOR).toString().toLatin1(); |
131 | - return FormFactor(d->formFactorEnum.keyToValue(key.constData())); |
132 | + QObject(parent) |
133 | +{ |
134 | } |
135 | |
136 | static int getenvInt(const char* name, int defaultValue) |
137 | |
138 | === modified file 'libunity-2d-private/src/dashsettings.h' |
139 | --- libunity-2d-private/src/dashsettings.h 2011-10-17 12:12:10 +0000 |
140 | +++ libunity-2d-private/src/dashsettings.h 2012-01-26 18:08:30 +0000 |
141 | @@ -23,12 +23,10 @@ |
142 | |
143 | // Qt |
144 | #include <QObject> |
145 | -#include <QMetaType> |
146 | +#include <QSize> |
147 | |
148 | namespace Unity2d { |
149 | |
150 | -class DashSettingsPrivate; |
151 | - |
152 | /** |
153 | * Provide easy access to the Dash settings (from Qt and QML) |
154 | */ |
155 | @@ -36,37 +34,15 @@ |
156 | { |
157 | Q_OBJECT |
158 | |
159 | - Q_ENUMS(FormFactor) |
160 | - |
161 | - Q_PROPERTY(FormFactor formFactor READ formFactor WRITE setFormFactor NOTIFY formFactorChanged) |
162 | - |
163 | public: |
164 | explicit DashSettings(QObject* parent = 0); |
165 | - ~DashSettings(); |
166 | - |
167 | - enum FormFactor |
168 | - { |
169 | - Automatic = 0, |
170 | - Desktop, |
171 | - Netbook |
172 | - }; |
173 | - |
174 | - void setFormFactor(FormFactor formFactor); |
175 | - FormFactor formFactor() const; |
176 | |
177 | static QSize minimumSizeForDesktop(); |
178 | |
179 | -Q_SIGNALS: |
180 | - void formFactorChanged(); |
181 | - |
182 | private: |
183 | Q_DISABLE_COPY(DashSettings) |
184 | - DashSettingsPrivate* d_ptr; |
185 | - Q_DECLARE_PRIVATE(DashSettings) |
186 | }; |
187 | |
188 | } // namespace Unity2d |
189 | |
190 | -Q_DECLARE_METATYPE(Unity2d::DashSettings::FormFactor) |
191 | - |
192 | #endif /* DASHSETTINGS_H */ |
193 | |
194 | === modified file 'panel/applets/appname/windowhelper.cpp' |
195 | --- panel/applets/appname/windowhelper.cpp 2011-12-02 04:22:53 +0000 |
196 | +++ panel/applets/appname/windowhelper.cpp 2012-01-26 18:08:30 +0000 |
197 | @@ -23,6 +23,7 @@ |
198 | #include "windowhelper.h" |
199 | |
200 | // Local |
201 | +#include "config.h" |
202 | |
203 | // unity-2d |
204 | #include <dashsettings.h> |
205 | @@ -45,6 +46,7 @@ |
206 | #include <QApplication> |
207 | #include <QDesktopWidget> |
208 | #include <QPoint> |
209 | +#include <QVariant> |
210 | |
211 | // X11 |
212 | #include <X11/Xlib.h> |
213 | @@ -123,12 +125,6 @@ |
214 | QMetaObject::invokeMethod(watcher, "nameChanged"); |
215 | } |
216 | |
217 | -static void geometryChangedCB(GObject* window, |
218 | - WindowHelper* watcher) |
219 | -{ |
220 | - QMetaObject::invokeMethod(watcher, "stateChanged"); |
221 | -} |
222 | - |
223 | void WindowHelper::update() |
224 | { |
225 | BamfWindow* bamfWindow = BamfMatcher::get_default().active_window(); |
226 | @@ -144,13 +140,6 @@ |
227 | const char *name = wnck_window_get_name(d->m_window); |
228 | d->m_activeWindowIsDash = qstrcmp(name, "unity-2d-places") == 0; |
229 | if (d->m_activeWindowIsDash) { |
230 | - /* Since we are not really minimizing and maximizing the dash we |
231 | - * cannot rely on the wnck "state-changed" signal to be emitted; |
232 | - * instead, listen for the "geometry-changed" and emit our |
233 | - * stateChanged() from that. */ |
234 | - d->m_connector.connect(G_OBJECT(d->m_window), "geometry-changed", |
235 | - G_CALLBACK(geometryChangedCB), this); |
236 | - |
237 | d->updateDashCanResize(); |
238 | } |
239 | |
240 | @@ -167,11 +156,7 @@ |
241 | return false; |
242 | } |
243 | if (d->m_activeWindowIsDash) { |
244 | - int x, y, width, height; |
245 | - wnck_window_get_geometry(d->m_window, &x, &y, &width, &height); |
246 | - const QRect windowGeometry(x, y, width, height); |
247 | - ScreenInfo* screenInfo = ScreenInfo::instance(); |
248 | - return screenInfo->panelsFreeGeometry() == windowGeometry; |
249 | + return dash2dConfiguration().property("fullScreen").toBool(); |
250 | } else { |
251 | return wnck_window_is_maximized(d->m_window); |
252 | } |
253 | @@ -226,7 +211,7 @@ |
254 | void WindowHelper::maximize() |
255 | { |
256 | if (d->m_activeWindowIsDash) { |
257 | - d->m_dashSettings->setFormFactor(DashSettings::Netbook); |
258 | + dash2dConfiguration().setProperty("fullScreen", QVariant(true)); |
259 | } else { |
260 | /* This currently cannot happen, because the window buttons are not |
261 | * shown in the panel for non maximized windows. It's here just for |
262 | @@ -238,7 +223,7 @@ |
263 | void WindowHelper::unmaximize() |
264 | { |
265 | if (d->m_activeWindowIsDash) { |
266 | - d->m_dashSettings->setFormFactor(DashSettings::Desktop); |
267 | + dash2dConfiguration().setProperty("fullScreen", QVariant(false)); |
268 | } else { |
269 | wnck_window_unmaximize(d->m_window); |
270 | } |
271 | |
272 | === modified file 'places/dash.qml' |
273 | --- places/dash.qml 2012-01-03 11:55:41 +0000 |
274 | +++ places/dash.qml 2012-01-26 18:08:30 +0000 |
275 | @@ -40,15 +40,11 @@ |
276 | value: (currentPage && currentPage.expanded != undefined) ? currentPage.expanded : true |
277 | } |
278 | |
279 | - DashSettings { |
280 | - id: settings |
281 | - } |
282 | - |
283 | Binding { |
284 | target: dashView |
285 | property: "dashMode" |
286 | - value: (settings.formFactor == DashSettings.Desktop) ? |
287 | - DashDeclarativeView.DesktopMode : DashDeclarativeView.FullScreenMode |
288 | + value: dash2dConfiguration.fullScreen ? DashDeclarativeView.FullScreenMode : |
289 | + DashDeclarativeView.DesktopMode |
290 | } |
291 | |
292 | function activatePage(page) { |
293 | |
294 | === added file 'tests/places/fullscreen.rb' |
295 | --- tests/places/fullscreen.rb 1970-01-01 00:00:00 +0000 |
296 | +++ tests/places/fullscreen.rb 2012-01-26 18:08:30 +0000 |
297 | @@ -0,0 +1,168 @@ |
298 | +#!/usr/bin/env ruby1.8 |
299 | +=begin |
300 | +/* |
301 | + * This file is part of unity-2d |
302 | + * |
303 | + * Copyright 2011 Canonical Ltd. |
304 | + * |
305 | + * Authors: |
306 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
307 | + * - Gerry Boland <gerry.boland@canonical.com> |
308 | + * |
309 | + * This program is free software; you can redistribute it and/or modify |
310 | + * it under the terms of the GNU General Public License as published by |
311 | + * the Free Software Foundation; version 3. |
312 | + * |
313 | + * This program is distributed in the hope that it will be useful, |
314 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
315 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
316 | + * GNU General Public License for more details. |
317 | + * |
318 | + * You should have received a copy of the GNU General Public License |
319 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
320 | + */ |
321 | +=end |
322 | + |
323 | +require '../run-tests.rb' unless $INIT_COMPLETED |
324 | +require 'xdo/xwindow' |
325 | +require 'xdo/keyboard' |
326 | +require 'xdo/mouse' |
327 | +require 'timeout' |
328 | +require 'tmpdir' |
329 | +require 'tempfile' |
330 | +include TDriverVerify |
331 | + |
332 | +############################# Test Suite ############################# |
333 | +context "Dash fullscreen tests" do |
334 | + pwd = File.expand_path(File.dirname(__FILE__)) + '/' |
335 | + |
336 | + DASH_FULLSCREEN_KEY = '/com/canonical/unity-2d/dash/full-screen' |
337 | + DASH_MIN_SCREEN_WIDTH = 1280; |
338 | + DASH_MIN_SCREEN_HEIGHT = 1084; |
339 | + |
340 | + # Run once at the beginning of this test suite |
341 | + startup do |
342 | + system 'killall unity-2d-places > /dev/null 2>&1' |
343 | + system 'killall unity-2d-panel > /dev/null 2>&1' |
344 | + system 'killall unity-2d-launcher > /dev/null 2>&1' |
345 | + system 'killall unity-2d-launcher > /dev/null 2>&1' |
346 | + |
347 | + # Minimize all windows |
348 | + XDo::XWindow.toggle_minimize_all |
349 | + end |
350 | + |
351 | + # Run once at the end of this test suite |
352 | + shutdown do |
353 | + end |
354 | + |
355 | + # Run before each test case begins |
356 | + setup do |
357 | + @oldvalue = %x{dconf read #{DASH_FULLSCREEN_KEY}}.chop |
358 | + |
359 | + # Execute the application |
360 | + @sut = TDriver.sut(:Id => "sut_qt") |
361 | + @dash = @sut.run(:name => UNITY_2D_PLACES, |
362 | + :arguments => "-testability", |
363 | + :sleeptime => 2) |
364 | + @panel = @sut.run(:name => UNITY_2D_PANEL, |
365 | + :arguments => "-testability", |
366 | + :sleeptime => 2) |
367 | + @launcher = @sut.run(:name => UNITY_2D_LAUNCHER, |
368 | + :arguments => "-testability", |
369 | + :sleeptime => 2) |
370 | + |
371 | + verify(10){ @panel.Unity2dPanel() } |
372 | + verify(10){ @launcher.Unity2dPanel() } |
373 | + # Dash can't be verified here as the declarative view is hidden until we make it active |
374 | + end |
375 | + |
376 | + # Run after each test case completes |
377 | + teardown do |
378 | + %x{dconf write #{DASH_FULLSCREEN_KEY} #{@oldvalue}} |
379 | + system "pkill -nf unity-2d-panel" |
380 | + system "pkill -nf unity-2d-places" |
381 | + system "pkill -nf unity-2d-launcher" |
382 | + end |
383 | + |
384 | + def dash_always_fullscreen |
385 | + out = %x{xdotool getdisplaygeometry} |
386 | + width, height = out.split.collect { |coord| coord.to_i } |
387 | + return width < DASH_MIN_SCREEN_WIDTH && height < DASH_MIN_SCREEN_HEIGHT |
388 | + end |
389 | + |
390 | + ##################################################################################### |
391 | + # Test cases |
392 | + |
393 | + test "Dash fullscreens on dconf key change" do |
394 | + %x{dconf write #{DASH_FULLSCREEN_KEY} false} |
395 | + XDo::Keyboard.super |
396 | + sleep 1 |
397 | + |
398 | + verify_equal('true', TIMEOUT, 'Dash did not appear') { |
399 | + @dash.DashDeclarativeView()['active'] |
400 | + } |
401 | + verify_equal('DesktopMode', TIMEOUT, 'Dash is fullscreen but should not be') { |
402 | + @dash.DashDeclarativeView()['dashMode'] |
403 | + } |
404 | + |
405 | + %x{dconf write #{DASH_FULLSCREEN_KEY} true} |
406 | + sleep 1 |
407 | + |
408 | + verify_equal('FullScreenMode', TIMEOUT, 'Dash is not fullscreen but should be') { |
409 | + @dash.DashDeclarativeView()['dashMode'] |
410 | + } |
411 | + end |
412 | + |
413 | + test "Dash reacts correctly to panel buttons" do |
414 | + oldvalue = %x{dconf read #{DASH_FULLSCREEN_KEY}} |
415 | + |
416 | + %x{dconf write #{DASH_FULLSCREEN_KEY} false} |
417 | + XDo::Keyboard.super |
418 | + sleep 1 |
419 | + verify_equal('true', TIMEOUT, 'Dash did not appear') { |
420 | + @dash.DashDeclarativeView()['active'] |
421 | + } |
422 | + |
423 | + maxbutton = nil |
424 | + verify(TIMEOUT, 'The "maximize" button did not appear when the dash was visible' ) { |
425 | + maxbutton = @panel.AppNameApplet().children( :type => 'QAbstractButton' )[2] |
426 | + } |
427 | + |
428 | + maxbutton.tap if maxbutton |
429 | + sleep 1 |
430 | + verify_equal('FullScreenMode', TIMEOUT, 'Dash should be fullsceen, but it is not' ) { |
431 | + @dash.DashDeclarativeView()['dashMode'] |
432 | + } |
433 | + verify_equal('true', TIMEOUT, 'Dash fullscreen key was not set') { |
434 | + %x{dconf read #{DASH_FULLSCREEN_KEY}}.chop |
435 | + } |
436 | + |
437 | + maxbutton.tap if maxbutton |
438 | + sleep 1 |
439 | + verify_equal('DesktopMode', TIMEOUT, 'Dash should not be fullsceen, but it is' ) { |
440 | + @dash.DashDeclarativeView()['dashMode'] |
441 | + } |
442 | + verify_equal('false', TIMEOUT, 'Dash fullscreen key was not unset') { |
443 | + %x{dconf read #{DASH_FULLSCREEN_KEY}}.chop |
444 | + } |
445 | + end |
446 | + |
447 | + test "Dash fullscreen initially" do |
448 | + # The initial startup mode ignores the dconf key and only decides based on the screen |
449 | + # resolution. It's a bug and will be fixed, but as long as it's there let's test for it. |
450 | + |
451 | + expect = dash_always_fullscreen ? 'FullScreenMode' : 'DesktopMode' |
452 | + initial = dash_always_fullscreen ? 'false' : 'true' |
453 | + %x{dconf write #{DASH_FULLSCREEN_KEY} #{initial}} |
454 | + XDo::Keyboard.super |
455 | + sleep 1 |
456 | + |
457 | + verify_equal('true', TIMEOUT, 'Dash did not appear') { |
458 | + @dash.DashDeclarativeView()['active'] |
459 | + } |
460 | + |
461 | + verify_equal(expect, TIMEOUT, 'Dash initial state is wrong') { |
462 | + @dash.DashDeclarativeView()['dashMode'] |
463 | + } |
464 | + end |
465 | +end |
Code looks great at first. Will carry slightly more detailed code inspection and functional review.