OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 // Get rid of X11 macros which conflict with gtest. | 10 // Get rid of X11 macros which conflict with gtest. |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 105, 15)); | 300 EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 105, 15)); |
301 | 301 |
302 // Changing the widget's size should not affect the shape. | 302 // Changing the widget's size should not affect the shape. |
303 widget2->SetBounds(gfx::Rect(100, 100, 200, 200)); | 303 widget2->SetBounds(gfx::Rect(100, 100, 200, 200)); |
304 shape_rects = GetShapeRects(xid2); | 304 shape_rects = GetShapeRects(xid2); |
305 ASSERT_FALSE(shape_rects.empty()); | 305 ASSERT_FALSE(shape_rects.empty()); |
306 EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 5, 5)); | 306 EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 5, 5)); |
307 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 15, 5)); | 307 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 15, 5)); |
308 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 95, 15)); | 308 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 95, 15)); |
309 EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 105, 15)); | 309 EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 105, 15)); |
| 310 |
| 311 // Setting the shape to NULL resets the shape back to the entire |
| 312 // window bounds. |
| 313 widget2->SetShape(NULL); |
| 314 shape_rects = GetShapeRects(xid2); |
| 315 ASSERT_FALSE(shape_rects.empty()); |
| 316 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 5, 5)); |
| 317 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 15, 5)); |
| 318 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 95, 15)); |
| 319 EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 105, 15)); |
| 320 EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 500, 500)); |
310 } | 321 } |
311 | 322 |
312 // Test that the widget ignores changes in fullscreen state initiated by the | 323 // Test that the widget ignores changes in fullscreen state initiated by the |
313 // window manager (e.g. via a window manager accelerator key). | 324 // window manager (e.g. via a window manager accelerator key). |
314 TEST_F(DesktopWindowTreeHostX11Test, WindowManagerTogglesFullscreen) { | 325 TEST_F(DesktopWindowTreeHostX11Test, WindowManagerTogglesFullscreen) { |
315 if (!ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_FULLSCREEN"))) | 326 if (!ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_FULLSCREEN"))) |
316 return; | 327 return; |
317 | 328 |
318 scoped_ptr<Widget> widget = CreateWidget(new ShapedWidgetDelegate()); | 329 scoped_ptr<Widget> widget = CreateWidget(new ShapedWidgetDelegate()); |
319 XID xid = widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget(); | 330 XID xid = widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 SubstructureRedirectMask | SubstructureNotifyMask, | 450 SubstructureRedirectMask | SubstructureNotifyMask, |
440 &xevent); | 451 &xevent); |
441 | 452 |
442 WMStateWaiter waiter(xid, "_NET_WM_STATE_FOCUSED", true); | 453 WMStateWaiter waiter(xid, "_NET_WM_STATE_FOCUSED", true); |
443 waiter.Wait(); | 454 waiter.Wait(); |
444 } | 455 } |
445 EXPECT_TRUE(widget.GetNativeWindow()->IsVisible()); | 456 EXPECT_TRUE(widget.GetNativeWindow()->IsVisible()); |
446 } | 457 } |
447 | 458 |
448 } // namespace views | 459 } // namespace views |
OLD | NEW |