Merge lp:~compiz-team/compiz/compiz.fix_1188900.1 into lp:compiz/0.9.10

Proposed by Sam Spilsbury
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 3744
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1188900.1
Merge into: lp:compiz/0.9.10
Diff against target: 1383 lines (+808/-157)
5 files modified
plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt (+2/-0)
plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp (+777/-132)
tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp (+6/-25)
tests/xorg-gtest/include/compiz-xorg-gtest.h (+3/-0)
tests/xorg-gtest/src/compiz-xorg-gtest.cpp (+20/-0)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1188900.1
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andrea Azzarone Approve
Review via email: mp+170954@code.launchpad.net

Commit message

Add more acceptance tests for the decor plugin.

PixmapDecoratedWindowAcceptance.
  UndecoratedWindowExpandToOrigSize

    Test that upon undecoration, the window has exactly the same geometry
    as it did before decoration.

  DISABLED_UndecorateStaticGravityWindow

    Tests that for windows with a static gravity, the window has exactly
    the same geometry as it did before decoration.

    Disabled, as core is currently not moving the window with the static
    gravity back to where it started.

AdjustmentExtents/PixmapDecorationAdjustment.
  AdjustRestoredWindowBorderMovesClient/P

    Test that changing the border extents causes the client window's
    absolute geometry to change.

  DISABLED_AdjustRestoredWindowBorderShrinkClient/P

    Tests that changing the border extents causes the client window's
    absolute geometry to shrink by the amount of border.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinks/P

    Tests that as the border shrinks away, the client expands back to
    its original size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinksWhilstMaximized/P

    Tests that even if the client is maximized, if the restored border
    shrinks away it demaximizes back to the same position while also
    accounting for any change in the restored window border size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinksWhilstUndecorated/P

    Tests that even when the client is not permitted to be decorated
    because the decoration hint was removed, when it is redecorated
    it will be moved to the correct position taking into account any
    changes in its border size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_AdjustRestoredWindowInputNoMoveClient/P

    Tests that adjusting the input extents (as independent from the
    border extents) of the client does not cause the client to move.

    Disabled, as this behavior appears to be broken in core.

Move the "GetImmediateParent" function into the compiz::testing namespace
so that it can be used by other tests.

Description of the change

Add more acceptance tests for the decor plugin.

PixmapDecoratedWindowAcceptance.
  UndecoratedWindowExpandToOrigSize

    Test that upon undecoration, the window has exactly the same geometry
    as it did before decoration.

  DISABLED_UndecorateStaticGravityWindow

    Tests that for windows with a static gravity, the window has exactly
    the same geometry as it did before decoration.

    Disabled, as core is currently not moving the window with the static
    gravity back to where it started.

AdjustmentExtents/PixmapDecorationAdjustment.
  AdjustRestoredWindowBorderMovesClient/P

    Test that changing the border extents causes the client window's
    absolute geometry to change.

  DISABLED_AdjustRestoredWindowBorderShrinkClient/P

    Tests that changing the border extents causes the client window's
    absolute geometry to shrink by the amount of border.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinks/P

    Tests that as the border shrinks away, the client expands back to
    its original size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinksWhilstMaximized/P

    Tests that even if the client is maximized, if the restored border
    shrinks away it demaximizes back to the same position while also
    accounting for any change in the restored window border size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinksWhilstUndecorated/P

    Tests that even when the client is not permitted to be decorated
    because the decoration hint was removed, when it is redecorated
    it will be moved to the correct position taking into account any
    changes in its border size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_AdjustRestoredWindowInputNoMoveClient/P

    Tests that adjusting the input extents (as independent from the
    border extents) of the client does not cause the client to move.

    Disabled, as this behavior appears to be broken in core.

Move the "GetImmediateParent" function into the compiz::testing namespace
so that it can be used by other tests.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
MC Return (mc-return) wrote :

What are all those "/P"s in the commit message about ?

I think some word is missing in this comment (probably it is 'disabled'):

264 + /* The use of the timeout is currently because some functionality
265 + * is broken which would cause these barrier conditions to never
266 + * eventuate. For now just get to the fail condition */

187 + void DisallowDecorationsOnWindow (Window window);

Maybe ForbidDecorationsOnWindow (Window window); would be better ? You decide.

This comment could be a one-liner (ultraminor):

406 + /* Select for StructureNotify on the parent and wrapper
407 + * windows */

823 - unsigned int width, height, border, depth;
824 + unsigned int width, height, border;

Don't we need depth anymore ? A quick search in the code shows that it was not
really used, although windows should have a depth for advanced animations, no ?

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On 23/06/2013 7:00 PM, "MC Return" <email address hidden> wrote:
>
> What are all those "/P"s in the commit message about ?

Just a demonstration that each test is parameterized (so its not repeated 4
times)
>
> I think some word is missing in this comment (probably it is 'disabled'):
>
> 264 + /* The use of the timeout is currently because some
functionality
> 265 + * is broken which would cause these barrier conditions to
never
> 266 + * eventuate. For now just get to the fail condition */

Thanks.

>
> 187 + void DisallowDecorationsOnWindow (Window window);
>
> Maybe ForbidDecorationsOnWindow (Window window); would be better ? You
decide.

That works too.
>
> This comment could be a one-liner (ultraminor):
>
> 406 + /* Select for StructureNotify on the parent and wrapper
> 407 + * windows */
>
> 823 - unsigned int width, height, border, depth;
> 824 + unsigned int width, height, border;
>
> Don't we need depth anymore ? A quick search in the code shows that it
was not
> really used, although windows should have a depth for advanced
animations, no ?

"Depth" as in bit depth . the variable was removed as I replaced
XGetGeometry usage with a wrapper function which doesn't return a value for
that variable as i don't care about it.

>
>
> --
>
https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1188900.1/+merge/170954
> Your team Compiz Maintainers is requested to review the proposed merge of
lp:~compiz-team/compiz/compiz.fix_1188900.1 into lp:compiz.

3743. By Sam Spilsbury

Only mark for no further instantiations once we've finished destructing
the plugin

(LP: #1193596). Fixes: https://bugs.launchpad.net/bugs/1193596.

Approved by PS Jenkins bot, Sami Jaktholm, MC Return.

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

LGTM.

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

[----------] Global test environment tear-down
Server terminated successfully (0). Closing log file.
[==========] 25 tests from 5 test cases ran. (9944 ms total)
[ PASSED ] 25 tests.

  YOU HAVE 19 DISABLED TESTS

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)
3744. By Sam Spilsbury

Add more acceptance tests for the decor plugin.

PixmapDecoratedWindowAcceptance.
  UndecoratedWindowExpandToOrigSize

    Test that upon undecoration, the window has exactly the same geometry
    as it did before decoration.

  DISABLED_UndecorateStaticGravityWindow

    Tests that for windows with a static gravity, the window has exactly
    the same geometry as it did before decoration.

    Disabled, as core is currently not moving the window with the static
    gravity back to where it started.

AdjustmentExtents/PixmapDecorationAdjustment.
  AdjustRestoredWindowBorderMovesClient/P

    Test that changing the border extents causes the client window's
    absolute geometry to change.

  DISABLED_AdjustRestoredWindowBorderShrinkClient/P

    Tests that changing the border extents causes the client window's
    absolute geometry to shrink by the amount of border.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinks/P

    Tests that as the border shrinks away, the client expands back to
    its original size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinksWhilstMaximized/P

    Tests that even if the client is maximized, if the restored border
    shrinks away it demaximizes back to the same position while also
    accounting for any change in the restored window border size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_ClientExpandsAsBorderShrinksWhilstUndecorated/P

    Tests that even when the client is not permitted to be decorated
    because the decoration hint was removed, when it is redecorated
    it will be moved to the correct position taking into account any
    changes in its border size.

    Disabled, as the current behavior is to expand the frame window
    as opposed to shrinking the client (but this will be changed).

  DISABLED_AdjustRestoredWindowInputNoMoveClient/P

    Tests that adjusting the input extents (as independent from the
    border extents) of the client does not cause the client to move.

    Disabled, as this behavior appears to be broken in core.

Move the "GetImmediateParent" function into the compiz::testing namespace
so that it can be used by other tests. Fixes: https://bugs.launchpad.net/bugs/1188900.

Approved by PS Jenkins bot, Andrea Azzarone.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt'
2--- plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt 2013-06-10 08:55:23 +0000
3+++ plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt 2013-06-22 14:36:23 +0000
4@@ -20,6 +20,8 @@
5 compiz_xorg_gtest_main
6 compiz_xorg_gtest_system_test
7 decoration
8+ compiz_point
9+ compiz_size
10 ${GMOCK_LIBRARY}
11 ${GMOCK_MAIN_LIBRARY}
12 ${GTEST_BOTH_LIBRARIES}
13
14=== modified file 'plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp'
15--- plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp 2013-06-15 03:52:41 +0000
16+++ plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp 2013-06-22 14:36:23 +0000
17@@ -36,6 +36,9 @@
18
19 #include "decoration.h"
20
21+#include <core/point.h>
22+#include <core/size.h>
23+
24 #include <xorg/gtest/xorg-gtest.h>
25 #include <compiz-xorg-gtest.h>
26
27@@ -50,6 +53,8 @@
28 using ::testing::Matcher;
29 using ::testing::MakeMatcher;
30 using ::testing::StrEq;
31+using ::testing::ValuesIn;
32+using ::testing::WithParamInterface;
33 using ::testing::_;
34
35 class BaseDecorAcceptance :
36@@ -172,6 +177,15 @@
37 const char *OtherDecorationManagerRunningMessage =
38 "Another decoration manager is already running";
39
40+struct MWMHints
41+{
42+ unsigned long flags;
43+ unsigned long functions;
44+ unsigned long decorations;
45+};
46+
47+static const unsigned int MwmDecor = 1L << 0;
48+
49 class FakeDecorator
50 {
51 public:
52@@ -223,6 +237,9 @@
53 unsigned int state,
54 unsigned int actions) const;
55
56+ virtual CompPoint restoredFrameWindowOffset () const = 0;
57+ virtual CompSize restoredDecorationSize () const = 0;
58+
59 protected:
60
61 void insertBaseData (std::vector <long> &) const;
62@@ -254,6 +271,8 @@
63
64 size_t propertyDataSize () const;
65 void addPropertyData (std::vector<long> &) const;
66+ CompPoint restoredFrameWindowOffset () const;
67+ CompSize restoredDecorationSize () const;
68
69 static const unsigned int WindowDecorationSize = 8;
70
71@@ -268,6 +287,8 @@
72 {
73 public:
74
75+ typedef boost::shared_ptr <FakePixmapTypeDecoration> Ptr;
76+
77 FakePixmapTypeDecoration (unsigned int type,
78 unsigned int state,
79 unsigned int actions,
80@@ -280,6 +301,12 @@
81 Display *dpy);
82 ~FakePixmapTypeDecoration ();
83
84+ void changeRestoredBorder (const decor_extents_t &border);
85+ void changeRestoredInput (const decor_extents_t &input);
86+
87+ CompPoint restoredFrameWindowOffset () const;
88+ CompSize restoredDecorationSize () const;
89+
90 protected:
91
92 size_t propertyDataSize () const;
93@@ -305,6 +332,11 @@
94 {
95 public:
96
97+ FakeDecorationList () :
98+ mDecorationType (WINDOW_DECORATION_TYPE_PIXMAP)
99+ {
100+ }
101+
102 FakeDecorationList (unsigned int type) :
103 mDecorationType (type)
104 {
105@@ -314,6 +346,7 @@
106 void RemoveDecoration (unsigned int type,
107 unsigned int state,
108 unsigned int actions);
109+ void RemoveAllDecorations ();
110
111 void SetPropertyOnWindow (Display *dpy,
112 Window w,
113@@ -558,6 +591,22 @@
114 return WINDOW_PROP_SIZE;
115 }
116
117+CompPoint
118+cdt::FakeWindowTypeDecoration::restoredFrameWindowOffset () const
119+{
120+ int xOffset = -mRestored.left;
121+ int yOffset = -mRestored.top;
122+
123+ return CompPoint (xOffset, yOffset);
124+}
125+
126+CompSize
127+cdt::FakeWindowTypeDecoration::restoredDecorationSize () const
128+{
129+ return CompSize (mRestored.left + mRestored.right,
130+ mRestored.top + mRestored.bottom);
131+}
132+
133 cdt::FakePixmapTypeDecoration::FakePixmapTypeDecoration (unsigned int type,
134 unsigned int state,
135 unsigned int actions,
136@@ -636,6 +685,34 @@
137 vec.push_back (propData[i]);
138 }
139
140+CompPoint
141+cdt::FakePixmapTypeDecoration::restoredFrameWindowOffset () const
142+{
143+ int xOffset = mRestoredBorder.left - mRestoredInput.left;
144+ int yOffset = mRestoredBorder.top - mRestoredInput.top;
145+
146+ return CompPoint (xOffset, yOffset);
147+}
148+
149+CompSize
150+cdt::FakePixmapTypeDecoration::restoredDecorationSize () const
151+{
152+ return CompSize (mRestoredInput.left + mRestoredInput.right,
153+ mRestoredInput.top + mRestoredInput.bottom);
154+}
155+
156+void
157+cdt::FakePixmapTypeDecoration::changeRestoredBorder (const decor_extents_t &b)
158+{
159+ mRestoredBorder = b;
160+}
161+
162+void
163+cdt::FakePixmapTypeDecoration::changeRestoredInput (const decor_extents_t &i)
164+{
165+ mRestoredInput = i;
166+}
167+
168 void
169 cdt::FakeDecorationList::AddDecoration (const cdt::FakeDecoration::Ptr &decoration)
170 {
171@@ -668,6 +745,11 @@
172 decorations.end ());
173 }
174
175+void cdt::FakeDecorationList::RemoveAllDecorations ()
176+{
177+ decorations.clear ();
178+}
179+
180 void
181 cdt::FakeDecorationList::SetPropertyOnWindow (Display *dpy,
182 Window w,
183@@ -894,12 +976,16 @@
184
185 void SetUpDecorator ();
186
187+ void DisallowDecorationsOnWindow (Window window);
188+ void AllowDecorationsOnWindow (Window window);
189+
190 std::auto_ptr <cdt::FakeDecorator> decorator;
191
192 Atom NETWMFrameExtentsAtom;
193 Atom WindowDecorationAtom;
194 Atom DefaultActiveDecorationAtom;
195 Atom DefaultBareDecorationAtom;
196+ Atom MWMHintsAtom;
197 };
198
199 void
200@@ -934,6 +1020,41 @@
201 SupportedDecorations ()));
202 }
203
204+namespace
205+{
206+void ChangeDecorationState (Display *display,
207+ Window window,
208+ unsigned int decorationFlags)
209+{
210+ Atom mwmHintsAtom = XInternAtom (display, "_MOTIF_WM_HINTS", 0);
211+ cdt::MWMHints hints;
212+
213+ hints.flags = 1L << 1;
214+ hints.decorations = decorationFlags;
215+
216+ XChangeProperty (display,
217+ window,
218+ mwmHintsAtom,
219+ mwmHintsAtom,
220+ 32,
221+ PropModeReplace,
222+ reinterpret_cast <unsigned char *> (&hints),
223+ 3);
224+}
225+}
226+
227+void
228+DecorFakeDecoratorAcceptance::DisallowDecorationsOnWindow (Window window)
229+{
230+ ChangeDecorationState (Display (), window, 0);
231+}
232+
233+void
234+DecorFakeDecoratorAcceptance::AllowDecorationsOnWindow (Window window)
235+{
236+ ChangeDecorationState (Display (), window, cdt::MwmDecor);
237+}
238+
239 void
240 DecorFakeDecoratorAcceptance::TearDown ()
241 {
242@@ -983,6 +1104,37 @@
243 matcher)));
244 }
245
246+void WaitForConfigureOn (Display *display,
247+ Window window,
248+ int x,
249+ int y,
250+ unsigned int width,
251+ unsigned int height,
252+ unsigned int mask)
253+{
254+ /* Wait for the ConfigureNotify on the frame window
255+ * after an offset move */
256+ ct::ConfigureNotifyXEventMatcher matcher (None,
257+ 0,
258+ x,
259+ y,
260+ width,
261+ height,
262+ mask);
263+
264+ /* The use of the timeout is currently because some functionality
265+ * is broken which would cause these barrier conditions to never
266+ * eventuate. For now just get to the fail condition */
267+ Advance (display,
268+ ct::WaitForEventOfTypeOnWindowMatching (display,
269+ window,
270+ ConfigureNotify,
271+ -1,
272+ -1,
273+ matcher,
274+ 1000));
275+}
276+
277 void WaitForFrameExtents (Display *dpy,
278 Window w)
279 {
280@@ -1158,7 +1310,7 @@
281
282 namespace
283 {
284-cdt::FakeDecoration::Ptr
285+cdt::FakePixmapTypeDecoration::Ptr
286 MakeFakePixmapTypeDecoration (unsigned int type,
287 unsigned int state,
288 unsigned int actions,
289@@ -1170,7 +1322,7 @@
290 const decor_extents_t &maximizedInput,
291 Display *dpy)
292 {
293- cdt::FakeDecoration *decoration =
294+ cdt::FakePixmapTypeDecoration *decoration =
295 new cdt::FakePixmapTypeDecoration (type,
296 state,
297 actions,
298@@ -1182,7 +1334,7 @@
299 maximizedInput,
300 dpy);
301
302- return boost::shared_ptr <cdt::FakeDecoration> (decoration);
303+ return boost::shared_ptr <cdt::FakePixmapTypeDecoration> (decoration);
304 }
305
306 decor_extents_t
307@@ -1469,52 +1621,209 @@
308
309 /* TODO: Get bare decorations tests */
310
311-class PixmapDecoratedWindowAcceptance :
312+/* Helper class with some useful member functions */
313+class PixmapDecoratorAcceptance :
314 public DecorWithPixmapDefaultsAcceptance
315 {
316 public:
317-
318- PixmapDecoratedWindowAcceptance ();
319-
320- virtual void SetUp ();
321- virtual void TearDown ();
322-
323- virtual bool StartDecoratorOnSetUp () const;
324-
325+
326+ typedef cdt::FakeDecoration::Ptr FakeDecorPtr;
327+ typedef cdt::FakePixmapTypeDecoration::Ptr FakePixDecorPtr;
328+
329+ Window CreateDecoratableWindow (::Display *display);
330+ Window MapAndReparent (::Display *display,
331+ Window window);
332+
333+ void DecorateWindow (::Display *display,
334+ Window window,
335+ const FakePixDecorPtr &decoration);
336+ void WaitForDecoration (::Display *display,
337+ Window window,
338+ const FakeDecorPtr &decoration);
339+ void WaitForDecorationUpdate (::Display *display,
340+ Window window,
341+ const FakeDecorPtr &decor);
342+
343+ cdt::FakeDecorationList GetDecorations (Window window);
344+ Window GetParent (Window window);
345+
346+ void ReconfigureDecoration (::Display *display,
347+ Window window,
348+ const FakePixDecorPtr &decor,
349+ cdt::FakeDecorationList &list,
350+ const decor_extents_t &border,
351+ const decor_extents_t &input);
352+
353+ bool DestroyWindow (::Display *display,
354+ Window window);
355+
356+
357 protected:
358-
359- Window mWindow;
360- Window mParent;
361- cdt::FakeDecorationList mDecorations;
362+
363+ std::map <Window, cdt::FakeDecorationList> windowDecorations;
364+ std::map <Window, Window> windowParents;
365 };
366
367-PixmapDecoratedWindowAcceptance::PixmapDecoratedWindowAcceptance () :
368- mDecorations (WINDOW_DECORATION_TYPE_PIXMAP)
369+Window
370+PixmapDecoratorAcceptance::CreateDecoratableWindow (::Display *display)
371 {
372+ return ct::CreateNormalWindow (display);
373 }
374
375-void
376-PixmapDecoratedWindowAcceptance::SetUp ()
377+Window
378+PixmapDecoratorAcceptance::MapAndReparent (::Display *display,
379+ Window window)
380 {
381- DecorWithPixmapDefaultsAcceptance::SetUp ();
382+ if (windowParents.find (window) != windowParents.end ())
383+ return windowParents[window];
384
385- mWindow = ct::CreateNormalWindow (Display ());
386- XSelectInput (Display (), mWindow,
387+ XSelectInput (display, window,
388 StructureNotifyMask |
389 PropertyChangeMask);
390- XMapRaised (Display (), mWindow);
391+ XMapRaised (display, window);
392
393 /* Wait for the window to be reparented */
394 Advance (Display (),
395- ct::WaitForEventOfTypeOnWindow (Display (),
396- mWindow,
397+ ct::WaitForEventOfTypeOnWindow (display,
398+ window,
399 ReparentNotify,
400 -1,
401 -1));
402
403- /* Select for StructureNotify events on the parent window */
404- mParent = FindParent (Display (), mWindow);
405- XSelectInput (Display (), mParent, StructureNotifyMask);
406+ /* Select for StructureNotify on the parent and wrapper
407+ * windows */
408+ windowParents[window] = FindParent (display, window);
409+
410+ Window root = 0;
411+ Window wrapper = ct::GetImmediateParent (display, window, root);
412+
413+ XSelectInput (display, windowParents[window], StructureNotifyMask);
414+ XSelectInput (display, wrapper, StructureNotifyMask);
415+
416+ return windowParents[window];
417+}
418+
419+void
420+PixmapDecoratorAcceptance::DecorateWindow (::Display *display,
421+ Window window,
422+ const FakePixDecorPtr &decoration)
423+{
424+ windowDecorations[window] = cdt::FakeDecorationList (WINDOW_DECORATION_TYPE_PIXMAP);
425+ windowDecorations[window].AddDecoration (decoration);
426+ windowDecorations[window].SetPropertyOnWindow (display,
427+ window,
428+ WindowDecorationAtom);
429+}
430+
431+void
432+PixmapDecoratorAcceptance::WaitForDecoration (::Display *display,
433+ Window window,
434+ const FakeDecorPtr &decoration)
435+{
436+ WaitForPropertyNotify (display, window, DECOR_INPUT_FRAME_ATOM_NAME);
437+ WaitForDecorationUpdate (display, window, decoration);
438+}
439+
440+void
441+PixmapDecoratorAcceptance::WaitForDecorationUpdate (::Display *display,
442+ Window window,
443+ const FakeDecorPtr &decor)
444+{
445+ /* Wait for the frame extents to change */
446+ WaitForPropertyNotify (display, window, "_NET_FRAME_EXTENTS");
447+
448+ const CompPoint &framePos (decor->restoredFrameWindowOffset ());
449+
450+ /* Wait for the ConfigureNotify on the frame window
451+ * after an offset move */
452+ WaitForConfigureOn (display,
453+ GetParent (window),
454+ framePos.x (),
455+ framePos.y (),
456+ 0,
457+ 0,
458+ CWX | CWY);
459+}
460+
461+void
462+PixmapDecoratorAcceptance::ReconfigureDecoration (::Display *display,
463+ Window window,
464+ const FakePixDecorPtr &decor,
465+ cdt::FakeDecorationList &list,
466+ const decor_extents_t &border,
467+ const decor_extents_t &input)
468+{
469+ decor->changeRestoredInput (input);
470+ decor->changeRestoredBorder (border);
471+ list.SetPropertyOnWindow (display,
472+ window,
473+ WindowDecorationAtom);
474+
475+ WaitForDecorationUpdate (display, window, decor);
476+}
477+
478+bool
479+PixmapDecoratorAcceptance::DestroyWindow (::Display *display,
480+ Window window)
481+{
482+ std::map <Window, Window>::iterator parentIterator =
483+ windowParents.find (window);
484+ std::map <Window, cdt::FakeDecorationList>::iterator decorIterator =
485+ windowDecorations.find (window);
486+
487+ if (parentIterator != windowParents.end ())
488+ windowParents.erase (parentIterator);
489+ if (decorIterator != windowDecorations.end ())
490+ {
491+ windowDecorations[window].RemoveAllDecorations ();
492+ windowDecorations.erase (decorIterator);
493+ }
494+
495+ XDestroyWindow (display, window);
496+
497+ return parentIterator != windowParents.end () ||
498+ decorIterator != windowDecorations.end ();
499+}
500+
501+Window
502+PixmapDecoratorAcceptance::GetParent (Window window)
503+{
504+ return windowParents[window];
505+}
506+
507+cdt::FakeDecorationList
508+PixmapDecoratorAcceptance::GetDecorations (Window window)
509+{
510+ return windowDecorations[window];
511+}
512+
513+class PixmapDecoratedWindowAcceptance :
514+ public PixmapDecoratorAcceptance
515+{
516+ public:
517+
518+ virtual void SetUp ();
519+ virtual void TearDown ();
520+
521+ virtual bool StartDecoratorOnSetUp () const;
522+
523+ protected:
524+
525+ Window mTestWindow;
526+ Window mTestWindowParent;
527+
528+ cdt::FakePixmapTypeDecoration::Ptr mTestWindowDecoration;
529+};
530+
531+void
532+PixmapDecoratedWindowAcceptance::SetUp ()
533+{
534+ DecorWithPixmapDefaultsAcceptance::SetUp ();
535+
536+ ::Display *display = Display ();
537+
538+ mTestWindow = CreateDecoratableWindow (display);
539+ mTestWindowParent = MapAndReparent (display, mTestWindow);
540
541 /* Start the decorator */
542 SetUpDecorator ();
543@@ -1523,7 +1832,7 @@
544 unsigned int ResIn = ActiveInputExtent;
545 unsigned int MaxEx = MaximizedBorderExtent;
546
547- cdt::FakeDecoration::Ptr decoration =
548+ mTestWindowDecoration =
549 MakeFakePixmapTypeDecoration (DECOR_WINDOW_TYPE_NORMAL,
550 0,
551 0,
552@@ -1535,38 +1844,14 @@
553 DecorationExtents (MaxEx, MaxEx, MaxEx, MaxEx),
554 Display ());
555
556- mDecorations.AddDecoration (decoration);
557- mDecorations.SetPropertyOnWindow (Display (),
558- mWindow,
559- WindowDecorationAtom);
560-
561- WaitForPropertyNotify (Display (), mWindow, DECOR_INPUT_FRAME_ATOM_NAME);
562- WaitForPropertyNotify (Display (), mWindow, "_NET_FRAME_EXTENTS");
563-
564- /* Wait for the parent window to be moved to -2, -2 */
565- ct::ConfigureNotifyXEventMatcher matcher (None,
566- 0,
567- ResBo - ResIn,
568- ResBo - ResIn,
569- 0,
570- 0,
571- CWX | CWY);
572-
573- Advance (Display (),
574- ct::WaitForEventOfTypeOnWindowMatching (Display (),
575- mParent,
576- ConfigureNotify,
577- -1,
578- -1,
579- matcher));
580+ DecorateWindow (display, mTestWindow, mTestWindowDecoration);
581+ WaitForDecoration (display, mTestWindow, mTestWindowDecoration);
582 }
583
584 void
585 PixmapDecoratedWindowAcceptance::TearDown ()
586 {
587- mDecorations.RemoveDecoration (DECOR_WINDOW_TYPE_NORMAL, 0, 0);
588-
589- XDestroyWindow (Display (), mWindow);
590+ DestroyWindow (Display (), mTestWindow);
591
592 DecorWithPixmapDefaultsAcceptance::TearDown ();
593 }
594@@ -1636,18 +1921,18 @@
595 ChangeStateOfWindow (Display (),
596 AddState,
597 "_NET_WM_STATE_MAXIMIZED_VERT",
598- mWindow);
599+ mTestWindow);
600
601 ChangeStateOfWindow (Display (),
602 AddState,
603 "_NET_WM_STATE_MAXIMIZED_HORZ",
604- mWindow);
605+ mTestWindow);
606
607- WaitForPropertyNotify (Display (), mWindow, "_NET_FRAME_EXTENTS");
608+ WaitForPropertyNotify (Display (), mTestWindow, "_NET_FRAME_EXTENTS");
609
610 boost::shared_ptr <unsigned char> data =
611 FetchCardinalProperty (Display (),
612- mWindow,
613+ mTestWindow,
614 NETWMFrameExtentsAtom);
615
616 unsigned long *frameExtents =
617@@ -1663,13 +1948,13 @@
618 ChangeStateOfWindow (Display (),
619 AddState,
620 "_NET_WM_STATE_MAXIMIZED_VERT",
621- mWindow);
622+ mTestWindow);
623
624- WaitForPropertyNotify (Display (), mWindow, "_NET_FRAME_EXTENTS");
625+ WaitForPropertyNotify (Display (), mTestWindow, "_NET_FRAME_EXTENTS");
626
627 boost::shared_ptr <unsigned char> data =
628 FetchCardinalProperty (Display (),
629- mWindow,
630+ mTestWindow,
631 NETWMFrameExtentsAtom);
632
633 unsigned long *frameExtents =
634@@ -1685,13 +1970,13 @@
635 ChangeStateOfWindow (Display (),
636 AddState,
637 "_NET_WM_STATE_MAXIMIZED_HORZ",
638- mWindow);
639+ mTestWindow);
640
641- WaitForPropertyNotify (Display (), mWindow, "_NET_FRAME_EXTENTS");
642+ WaitForPropertyNotify (Display (), mTestWindow, "_NET_FRAME_EXTENTS");
643
644 boost::shared_ptr <unsigned char> data =
645 FetchCardinalProperty (Display (),
646- mWindow,
647+ mTestWindow,
648 NETWMFrameExtentsAtom);
649
650 unsigned long *frameExtents =
651@@ -1712,12 +1997,12 @@
652 ChangeStateOfWindow (Display (),
653 AddState,
654 "_NET_WM_STATE_MAXIMIZED_VERT",
655- mWindow);
656+ mTestWindow);
657
658 ChangeStateOfWindow (Display (),
659 AddState,
660 "_NET_WM_STATE_MAXIMIZED_HORZ",
661- mWindow);
662+ mTestWindow);
663
664 ct::ConfigureNotifyXEventMatcher matcher (None,
665 0,
666@@ -1729,7 +2014,7 @@
667
668 EXPECT_TRUE (Advance (Display (),
669 ct::WaitForEventOfTypeOnWindowMatching (Display (),
670- mParent,
671+ mTestWindowParent,
672 ConfigureNotify,
673 -1,
674 -1,
675@@ -1744,7 +2029,7 @@
676 ChangeStateOfWindow (Display (),
677 AddState,
678 "_NET_WM_STATE_MAXIMIZED_VERT",
679- mWindow);
680+ mTestWindow);
681
682 ct::ConfigureNotifyXEventMatcher matcher (None,
683 0,
684@@ -1756,7 +2041,7 @@
685
686 EXPECT_TRUE (Advance (Display (),
687 ct::WaitForEventOfTypeOnWindowMatching (Display (),
688- mParent,
689+ mTestWindowParent,
690 ConfigureNotify,
691 -1,
692 -1,
693@@ -1771,7 +2056,7 @@
694 ChangeStateOfWindow (Display (),
695 AddState,
696 "_NET_WM_STATE_MAXIMIZED_HORZ",
697- mWindow);
698+ mTestWindow);
699
700 ct::ConfigureNotifyXEventMatcher matcher (None,
701 0,
702@@ -1783,7 +2068,7 @@
703
704 EXPECT_TRUE (Advance (Display (),
705 ct::WaitForEventOfTypeOnWindowMatching (Display (),
706- mParent,
707+ mTestWindowParent,
708 ConfigureNotify,
709 -1,
710 -1,
711@@ -1792,12 +2077,58 @@
712
713 namespace
714 {
715+void RelativeWindowGeometry (Display *dpy,
716+ Window w,
717+ int &x,
718+ int &y,
719+ unsigned int &width,
720+ unsigned int &height,
721+ unsigned int &border)
722+{
723+ Window root;
724+ unsigned int depth;
725+
726+ if (!XGetGeometry (dpy, w, &root, &x, &y, &width, &height, &border, &depth))
727+ throw std::logic_error ("XGetGeometry failed");
728+}
729+
730+void AbsoluteWindowGeometry (::Display *display,
731+ Window window,
732+ int &x,
733+ int &y,
734+ unsigned int &width,
735+ unsigned int &height,
736+ unsigned int &border)
737+{
738+ Window root;
739+ Window child;
740+ unsigned int depth;
741+
742+ if (!XGetGeometry (display, window, &root,
743+ &x, &y, &width, &height,
744+ &border, &depth))
745+ throw std::logic_error ("XGetGeometry failed");
746+
747+ if (!XTranslateCoordinates (display, window, root, x, y,
748+ &x, &y, &child))
749+ throw std::logic_error ("XTranslateCoordinates failed");
750+}
751+
752+typedef void (*RetrievalFunc) (Display *dpy,
753+ Window window,
754+ int &x,
755+ int &y,
756+ unsigned int &width,
757+ unsigned int &height,
758+ unsigned int &border);
759+
760 class WindowGeometryMatcher :
761 public MatcherInterface <Window>
762 {
763 public:
764
765 WindowGeometryMatcher (Display *dpy,
766+ RetrievalFunc func,
767 const Matcher <int> &x,
768 const Matcher <int> &y,
769 const Matcher <unsigned int> &width,
770@@ -1811,6 +2142,8 @@
771
772 Display *mDpy;
773
774+ RetrievalFunc mFunc;
775+
776 Matcher <int> mX;
777 Matcher <int> mY;
778 Matcher <unsigned int> mWidth;
779@@ -1819,14 +2152,16 @@
780 };
781
782 Matcher <Window>
783-WindowGeometry (Display *dpy,
784- const Matcher <int> &x,
785- const Matcher <int> &y,
786- const Matcher <unsigned int> &width,
787- const Matcher <unsigned int> &height,
788- const Matcher <unsigned int> &border)
789+HasGeometry (Display *dpy,
790+ RetrievalFunc func,
791+ const Matcher <int> &x,
792+ const Matcher <int> &y,
793+ const Matcher <unsigned int> &width,
794+ const Matcher <unsigned int> &height,
795+ const Matcher <unsigned int> &border)
796 {
797 return MakeMatcher (new WindowGeometryMatcher (dpy,
798+ func,
799 x,
800 y,
801 width,
802@@ -1836,12 +2171,14 @@
803 }
804
805 WindowGeometryMatcher::WindowGeometryMatcher (Display *dpy,
806+ RetrievalFunc func,
807 const Matcher <int> &x,
808 const Matcher <int> &y,
809 const Matcher <unsigned int> &width,
810 const Matcher <unsigned int> &height,
811 const Matcher <unsigned int> &border) :
812 mDpy (dpy),
813+ mFunc (func),
814 mX (x),
815 mY (y),
816 mWidth (width),
817@@ -1854,12 +2191,10 @@
818 WindowGeometryMatcher::MatchAndExplain (Window w,
819 MatchResultListener *listener) const
820 {
821- Window root;
822 int x, y;
823- unsigned int width, height, border, depth;
824+ unsigned int width, height, border;
825
826- if (!XGetGeometry (mDpy, w, &root, &x, &y, &width, &height, &border, &depth))
827- throw std::logic_error ("XGetGeometry failed");
828+ mFunc (mDpy, w, x, y, width, height, border);
829
830 bool match = mX.MatchAndExplain (x, listener) &&
831 mY.MatchAndExplain (y, listener) &&
832@@ -1925,39 +2260,37 @@
833 XWindowAttributes rootAttrib, attrib;
834 XGetWindowAttributes (Display (), DefaultRootWindow (Display ()), &rootAttrib);
835
836- WindowBorderPositionAttributes (Display (), mParent, attrib, ActiveBorderExtent, ActiveInputExtent);
837+ WindowBorderPositionAttributes (Display (),
838+ mTestWindowParent,
839+ attrib,
840+ ActiveBorderExtent,
841+ ActiveInputExtent);
842
843 ChangeStateOfWindow (Display (),
844 AddState,
845 "_NET_WM_STATE_MAXIMIZED_VERT",
846- mWindow);
847+ mTestWindow);
848
849 /* Wait for the window to be maximized first */
850- ct::ConfigureNotifyXEventMatcher matcher (None,
851- 0,
852- 0,
853- 0,
854- 0,
855- rootAttrib.height,
856- CWY | CWHeight);
857-
858- Advance (Display (),
859- ct::WaitForEventOfTypeOnWindowMatching (Display (),
860- mParent,
861- ConfigureNotify,
862- -1,
863- -1,
864- matcher));
865+ WaitForConfigureOn (Display (),
866+ mTestWindowParent,
867+ 0,
868+ 0,
869+ 0,
870+ rootAttrib.height,
871+ CWY | CWHeight);
872
873 /* Query the window geometry and ensure that the width and
874 * height have remained the same (adding on any extended borders,
875 * in this case 0) */
876- EXPECT_THAT (mParent, WindowGeometry (Display (),
877- attrib.x,
878- _,
879- attrib.width,
880- _,
881- _));
882+ EXPECT_THAT (mTestWindowParent,
883+ HasGeometry (Display (),
884+ RelativeWindowGeometry,
885+ attrib.x,
886+ _,
887+ attrib.width,
888+ _,
889+ _));
890 }
891
892 /* DISABLED - Upon maximization, y offset is 1, height offset is 10 */
893@@ -1966,38 +2299,350 @@
894 XWindowAttributes rootAttrib, attrib;
895 XGetWindowAttributes (Display (), DefaultRootWindow (Display ()), &rootAttrib);
896
897- WindowBorderPositionAttributes (Display (), mParent, attrib, ActiveBorderExtent, ActiveInputExtent);
898+ WindowBorderPositionAttributes (Display (),
899+ mTestWindowParent,
900+ attrib,
901+ ActiveBorderExtent,
902+ ActiveInputExtent);
903
904 ChangeStateOfWindow (Display (),
905 AddState,
906 "_NET_WM_STATE_MAXIMIZED_HORZ",
907- mWindow);
908+ mTestWindow);
909
910 /* Wait for the window to be maximized first */
911- ct::ConfigureNotifyXEventMatcher matcher (None,
912- 0,
913- 0,
914- 0,
915- rootAttrib.width,
916- 0,
917- CWX | CWWidth);
918-
919- Advance (Display (),
920- ct::WaitForEventOfTypeOnWindowMatching (Display (),
921- mParent,
922- ConfigureNotify,
923- -1,
924- -1,
925- matcher));
926+ WaitForConfigureOn (Display (),
927+ mTestWindowParent,
928+ 0,
929+ 0,
930+ rootAttrib.width,
931+ 0,
932+ CWX | CWWidth);
933
934 /* Query the window geometry and ensure that the width and
935 * height have remained the same (adding on any extended borders,
936 * in this case 0) */
937- EXPECT_THAT (mParent, WindowGeometry (Display (),
938- _,
939- attrib.y,
940- _,
941- attrib.height,
942- _));
943-}
944-
945+ EXPECT_THAT (mTestWindowParent,
946+ HasGeometry (Display (),
947+ RelativeWindowGeometry,
948+ _,
949+ attrib.y,
950+ _,
951+ attrib.height,
952+ _));
953+}
954+
955+/* Ensure that a window expands to its original size when it is
956+ * undecorated */
957+TEST_F (PixmapDecoratedWindowAcceptance, UndecoratedWindowExpandToOrigSize)
958+{
959+ DisallowDecorationsOnWindow (mTestWindow);
960+
961+ WaitForConfigureOn (Display (),
962+ mTestWindowParent,
963+ ct::WINDOW_X,
964+ ct::WINDOW_Y,
965+ ct::WINDOW_WIDTH,
966+ ct::WINDOW_HEIGHT,
967+ CWX | CWY | CWWidth | CWHeight);
968+
969+ EXPECT_THAT (mTestWindow,
970+ HasGeometry (Display (),
971+ AbsoluteWindowGeometry,
972+ ct::WINDOW_X,
973+ ct::WINDOW_Y,
974+ ct::WINDOW_WIDTH,
975+ ct::WINDOW_HEIGHT,
976+ _));
977+}
978+
979+/* DISABLED - Ensure that a window with StaticGravity expands to its
980+ * original size when it is undecorated
981+ *
982+ * X and Y positions do not revert back to their original state.
983+ */
984+TEST_F (PixmapDecoratedWindowAcceptance, DISABLED_UndecorateStaticGravityWindow)
985+{
986+ XSizeHints hints;
987+
988+ hints.flags = PWinGravity;
989+ hints.win_gravity = StaticGravity;
990+
991+ XSetWMNormalHints (Display (), mTestWindow, &hints);
992+ DisallowDecorationsOnWindow (mTestWindow);
993+
994+ WaitForConfigureOn (Display (),
995+ mTestWindowParent,
996+ ct::WINDOW_X,
997+ ct::WINDOW_Y,
998+ ct::WINDOW_WIDTH,
999+ ct::WINDOW_HEIGHT,
1000+ CWX | CWY | CWWidth | CWHeight);
1001+
1002+ EXPECT_THAT (mTestWindow,
1003+ HasGeometry (Display (),
1004+ AbsoluteWindowGeometry,
1005+ ct::WINDOW_X,
1006+ ct::WINDOW_Y,
1007+ ct::WINDOW_WIDTH,
1008+ ct::WINDOW_HEIGHT,
1009+ _));
1010+}
1011+
1012+class PixmapDecorationAdjustment :
1013+ public PixmapDecoratedWindowAcceptance,
1014+ public WithParamInterface <decor_extents_t>
1015+{
1016+ public:
1017+
1018+ void MaximizeWindow (Window window);
1019+ void RestoreWindow (Window window,
1020+ int restoredFrameX,
1021+ int restoredFrameY,
1022+ unsigned int restoredFrameWidth,
1023+ unsigned int restoredFrameHeight);
1024+};
1025+
1026+void
1027+PixmapDecorationAdjustment::MaximizeWindow (Window window)
1028+{
1029+ XWindowAttributes rootAttrib;
1030+ XGetWindowAttributes (Display (), DefaultRootWindow (Display ()), &rootAttrib);
1031+
1032+ ChangeStateOfWindow (Display (),
1033+ AddState,
1034+ "_NET_WM_STATE_MAXIMIZED_HORZ",
1035+ window);
1036+
1037+ ChangeStateOfWindow (Display (),
1038+ AddState,
1039+ "_NET_WM_STATE_MAXIMIZED_VERT",
1040+ window);
1041+
1042+ /* Wait for the window to be maximized first */
1043+ WaitForConfigureOn (Display (),
1044+ mTestWindowParent,
1045+ 0,
1046+ 0,
1047+ rootAttrib.width,
1048+ rootAttrib.height,
1049+ CWX | CWY | CWWidth | CWHeight);
1050+}
1051+
1052+void
1053+PixmapDecorationAdjustment::RestoreWindow (Window window,
1054+ int restoredFrameX,
1055+ int restoredFrameY,
1056+ unsigned int restoredFrameWidth,
1057+ unsigned int restoredFrameHeight)
1058+{
1059+ ChangeStateOfWindow (Display (),
1060+ RemoveState,
1061+ "_NET_WM_STATE_MAXIMIZED_HORZ",
1062+ window);
1063+
1064+ ChangeStateOfWindow (Display (),
1065+ RemoveState,
1066+ "_NET_WM_STATE_MAXIMIZED_VERT",
1067+ window);
1068+
1069+ /* Wait for the window to be restored first */
1070+ WaitForConfigureOn (Display (),
1071+ mTestWindowParent,
1072+ restoredFrameX,
1073+ restoredFrameY,
1074+ restoredFrameWidth,
1075+ restoredFrameHeight,
1076+ CWX | CWY | CWWidth | CWHeight);
1077+}
1078+
1079+TEST_P (PixmapDecorationAdjustment, AdjustRestoredWindowBorderMovesClient)
1080+{
1081+ ReconfigureDecoration (Display (),
1082+ mTestWindow,
1083+ mTestWindowDecoration,
1084+ windowDecorations[mTestWindow],
1085+ GetParam (),
1086+ GetParam ());
1087+
1088+ EXPECT_THAT (mTestWindow, HasGeometry (Display (),
1089+ AbsoluteWindowGeometry,
1090+ ct::WINDOW_X + GetParam ().left,
1091+ ct::WINDOW_Y + GetParam ().top,
1092+ _,
1093+ _,
1094+ _));
1095+}
1096+
1097+TEST_P (PixmapDecorationAdjustment, DISABLED_AdjustRestoredWindowBorderShrinkClient)
1098+{
1099+ ReconfigureDecoration (Display (),
1100+ mTestWindow,
1101+ mTestWindowDecoration,
1102+ windowDecorations[mTestWindow],
1103+ GetParam (),
1104+ GetParam ());
1105+
1106+ EXPECT_THAT (mTestWindow, HasGeometry (Display (),
1107+ AbsoluteWindowGeometry,
1108+ _,
1109+ _,
1110+ ct::WINDOW_WIDTH - (GetParam ().left +
1111+ GetParam ().right),
1112+ ct::WINDOW_HEIGHT - (GetParam ().top +
1113+ GetParam ().bottom),
1114+ _));
1115+}
1116+
1117+TEST_P (PixmapDecorationAdjustment, DISABLED_ClientExpandsAsBorderShrinks)
1118+{
1119+ decor_extents_t newExtents = GetParam ();
1120+
1121+ ReconfigureDecoration (Display (),
1122+ mTestWindow,
1123+ mTestWindowDecoration,
1124+ windowDecorations[mTestWindow],
1125+ DecorationExtents (10, 10, 10, 10),
1126+ DecorationExtents (10, 10, 10, 10));
1127+
1128+ ReconfigureDecoration (Display (),
1129+ mTestWindow,
1130+ mTestWindowDecoration,
1131+ windowDecorations[mTestWindow],
1132+ newExtents,
1133+ DecorationExtents (10, 10, 10, 10));
1134+
1135+ EXPECT_THAT (mTestWindow, HasGeometry (Display (),
1136+ AbsoluteWindowGeometry,
1137+ _,
1138+ _,
1139+ ct::WINDOW_WIDTH - (newExtents.left +
1140+ newExtents.right),
1141+ ct::WINDOW_HEIGHT - (newExtents.top +
1142+ newExtents.bottom),
1143+ _));
1144+}
1145+
1146+TEST_P (PixmapDecorationAdjustment, DISABLED_ClientExpandsAsBorderShrinksWhilstMaximized)
1147+{
1148+ decor_extents_t newExtents = GetParam ();
1149+
1150+ ReconfigureDecoration (Display (),
1151+ mTestWindow,
1152+ mTestWindowDecoration,
1153+ windowDecorations[mTestWindow],
1154+ DecorationExtents (10, 10, 10, 10),
1155+ DecorationExtents (10, 10, 10, 10));
1156+
1157+ MaximizeWindow (mTestWindow);
1158+
1159+ /* Set the property on the window, then demaximize without waiting
1160+ * for a response we will continue to use the maximized window decoration */
1161+ mTestWindowDecoration->changeRestoredBorder (newExtents);
1162+ windowDecorations[mTestWindow].SetPropertyOnWindow (Display (),
1163+ mTestWindow,
1164+ WindowDecorationAtom);
1165+
1166+ const CompPoint &off (mTestWindowDecoration->restoredFrameWindowOffset ());
1167+ const CompSize &size (mTestWindowDecoration->restoredDecorationSize ());
1168+
1169+ RestoreWindow (mTestWindow,
1170+ ct::WINDOW_X - off.x (),
1171+ ct::WINDOW_Y - off.y (),
1172+ ct::WINDOW_WIDTH + size.width (),
1173+ ct::WINDOW_HEIGHT + size.height ());
1174+
1175+ EXPECT_THAT (mTestWindow, HasGeometry (Display (),
1176+ AbsoluteWindowGeometry,
1177+ ct::WINDOW_X + newExtents.left,
1178+ ct::WINDOW_Y + newExtents.right,
1179+ ct::WINDOW_WIDTH - (newExtents.left +
1180+ newExtents.right),
1181+ ct::WINDOW_HEIGHT - (newExtents.top +
1182+ newExtents.bottom),
1183+ _));
1184+}
1185+
1186+TEST_P (PixmapDecorationAdjustment, DISABLED_ClientExpandsAsBorderShrinksWhilstUndecorated)
1187+{
1188+ decor_extents_t newExtents = GetParam ();
1189+
1190+ ReconfigureDecoration (Display (),
1191+ mTestWindow,
1192+ mTestWindowDecoration,
1193+ windowDecorations[mTestWindow],
1194+ DecorationExtents (10, 10, 10, 10),
1195+ DecorationExtents (10, 10, 10, 10));
1196+
1197+ DisallowDecorationsOnWindow (mTestWindow);
1198+
1199+ WaitForConfigureOn (Display (),
1200+ mTestWindowParent,
1201+ ct::WINDOW_X,
1202+ ct::WINDOW_Y,
1203+ ct::WINDOW_WIDTH,
1204+ ct::WINDOW_HEIGHT,
1205+ CWX | CWY | CWWidth | CWHeight);
1206+
1207+ /* Set the property on the window, then decorate without waiting
1208+ * for a response we will continue to use the maximized window decoration */
1209+ mTestWindowDecoration->changeRestoredBorder (newExtents);
1210+ windowDecorations[mTestWindow].SetPropertyOnWindow (Display (),
1211+ mTestWindow,
1212+ WindowDecorationAtom);
1213+
1214+ AllowDecorationsOnWindow (mTestWindow);
1215+
1216+ const CompPoint &off (mTestWindowDecoration->restoredFrameWindowOffset ());
1217+ const CompSize &size (mTestWindowDecoration->restoredDecorationSize ());
1218+
1219+ WaitForConfigureOn (Display (),
1220+ mTestWindowParent,
1221+ ct::WINDOW_X - off.x (),
1222+ ct::WINDOW_Y - off.y (),
1223+ ct::WINDOW_WIDTH + size.width (),
1224+ ct::WINDOW_HEIGHT + size.height (),
1225+ CWX | CWY | CWWidth | CWHeight);
1226+
1227+ EXPECT_THAT (mTestWindow, HasGeometry (Display (),
1228+ AbsoluteWindowGeometry,
1229+ ct::WINDOW_X + newExtents.left,
1230+ ct::WINDOW_Y + newExtents.right,
1231+ ct::WINDOW_WIDTH - (newExtents.left +
1232+ newExtents.right),
1233+ ct::WINDOW_HEIGHT - (newExtents.top +
1234+ newExtents.bottom),
1235+ _));
1236+}
1237+
1238+TEST_P (PixmapDecorationAdjustment, AdjustRestoredWindowInputNoMoveClient)
1239+{
1240+ decor_extents_t newExtents = GetParam ();
1241+
1242+ ReconfigureDecoration (Display (),
1243+ mTestWindow,
1244+ mTestWindowDecoration,
1245+ windowDecorations[mTestWindow],
1246+ DecorationExtents (1, 1, 1, 1),
1247+ newExtents);
1248+
1249+ EXPECT_THAT (mTestWindow, HasGeometry (Display (),
1250+ AbsoluteWindowGeometry,
1251+ ct::WINDOW_X + 1,
1252+ ct::WINDOW_Y + 1,
1253+ _,
1254+ _,
1255+ _));
1256+}
1257+
1258+decor_extents_t AdjustmentExtents[] =
1259+{
1260+ DecorationExtents (2, 0, 0, 0),
1261+ DecorationExtents (0, 2, 0, 0),
1262+ DecorationExtents (0, 0, 2, 0),
1263+ DecorationExtents (0, 0, 0, 2)
1264+};
1265+
1266+INSTANTIATE_TEST_CASE_P (AdjustmentExtents,
1267+ PixmapDecorationAdjustment,
1268+ ValuesIn (AdjustmentExtents));
1269
1270=== modified file 'tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp'
1271--- tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-04-03 08:46:17 +0000
1272+++ tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-06-22 14:36:23 +0000
1273@@ -55,25 +55,6 @@
1274 return ct::AdvanceToNextEventOnSuccess (d, r);
1275 }
1276
1277-Window GetImmediateParent (Display *display,
1278- Window w,
1279- Window &rootReturn)
1280-{
1281- Window parentReturn = w;
1282- Window *childrenReturn;
1283- unsigned int nChildrenReturn;
1284-
1285- XQueryTree (display,
1286- w,
1287- &rootReturn,
1288- &parentReturn,
1289- &childrenReturn,
1290- &nChildrenReturn);
1291- XFree (childrenReturn);
1292-
1293- return parentReturn;
1294-}
1295-
1296
1297 Window GetTopParent (Display *display,
1298 Window w)
1299@@ -86,9 +67,9 @@
1300 {
1301 lastParent = parentReturn;
1302
1303- parentReturn = GetImmediateParent (display,
1304- lastParent,
1305- rootReturn);
1306+ parentReturn = ct::GetImmediateParent (display,
1307+ lastParent,
1308+ rootReturn);
1309
1310 } while (parentReturn != rootReturn);
1311
1312@@ -616,7 +597,7 @@
1313
1314 /* Wrapper geometry is extents.xy, size.wh */
1315 Window root;
1316- Window wrapper = GetImmediateParent (dpy, w.client, root);
1317+ Window wrapper = ct::GetImmediateParent (dpy, w.client, root);
1318 ASSERT_TRUE (VerifyWindowSize (wrapper,
1319 left,
1320 top,
1321@@ -697,7 +678,7 @@
1322
1323 /* Wrapper geometry is extents.xy, size.wh */
1324 Window root;
1325- Window wrapper = GetImmediateParent (dpy, client, root);
1326+ Window wrapper = ct::GetImmediateParent (dpy, client, root);
1327 ASSERT_TRUE (VerifyWindowSize (wrapper,
1328 left,
1329 top,
1330@@ -752,7 +733,7 @@
1331
1332 /* Wrapper geometry is extents.xy, size.wh */
1333 Window root;
1334- Window wrapper = GetImmediateParent (dpy, client, root);
1335+ Window wrapper = ct::GetImmediateParent (dpy, client, root);
1336 ASSERT_TRUE (VerifyWindowSize (wrapper,
1337 left,
1338 top,
1339
1340=== modified file 'tests/xorg-gtest/include/compiz-xorg-gtest.h'
1341--- tests/xorg-gtest/include/compiz-xorg-gtest.h 2013-06-10 08:43:28 +0000
1342+++ tests/xorg-gtest/include/compiz-xorg-gtest.h 2013-06-22 14:36:23 +0000
1343@@ -122,6 +122,9 @@
1344 const unsigned int WINDOW_HEIGHT = 480;
1345
1346 Window CreateNormalWindow (Display *dpy);
1347+ Window GetImmediateParent (Display *display,
1348+ Window w,
1349+ Window &rootReturn);
1350
1351 std::list <Window> NET_CLIENT_LIST_STACKING (Display *);
1352 bool AdvanceToNextEventOnSuccess (Display *dpy,
1353
1354=== modified file 'tests/xorg-gtest/src/compiz-xorg-gtest.cpp'
1355--- tests/xorg-gtest/src/compiz-xorg-gtest.cpp 2013-04-15 13:09:33 +0000
1356+++ tests/xorg-gtest/src/compiz-xorg-gtest.cpp 2013-06-22 14:36:23 +0000
1357@@ -85,6 +85,26 @@
1358 return w;
1359 }
1360
1361+Window
1362+ct::GetImmediateParent (Display *display,
1363+ Window w,
1364+ Window &rootReturn)
1365+{
1366+ Window parentReturn = w;
1367+ Window *childrenReturn;
1368+ unsigned int nChildrenReturn;
1369+
1370+ XQueryTree (display,
1371+ w,
1372+ &rootReturn,
1373+ &parentReturn,
1374+ &childrenReturn,
1375+ &nChildrenReturn);
1376+ XFree (childrenReturn);
1377+
1378+ return parentReturn;
1379+}
1380+
1381 bool
1382 ct::AdvanceToNextEventOnSuccess (Display *dpy,
1383 bool waitResult)

Subscribers

People subscribed via source and target branches

to all changes: