Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: components/exo/sub_surface_unittest.cc

Issue 1419373013: exo: Add support for subcompositor interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exosphere-xdg-shell
Patch Set: rebase Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/exo/sub_surface.h"
6 #include "components/exo/surface.h"
7 #include "components/exo/test/exo_test_base.h"
8 #include "components/exo/test/exo_test_helper.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace exo {
12 namespace {
13
14 using SubSurfaceTest = test::ExoTestBase;
15
16 TEST_F(SubSurfaceTest, SetPosition) {
17 scoped_ptr<Surface> parent(new Surface);
18 scoped_ptr<Surface> surface(new Surface);
19 scoped_ptr<SubSurface> sub_surface(
20 new SubSurface(surface.get(), parent.get()));
21
22 sub_surface->SetPosition(gfx::Point(10, 10));
23 parent->Commit();
24 }
25
26 TEST_F(SubSurfaceTest, PlaceAbove) {
27 scoped_ptr<Surface> parent(new Surface);
28 scoped_ptr<Surface> surface1(new Surface);
29 scoped_ptr<Surface> surface2(new Surface);
30 scoped_ptr<Surface> non_sibling_surface(new Surface);
31 scoped_ptr<SubSurface> sub_surface1(
32 new SubSurface(surface1.get(), parent.get()));
33 scoped_ptr<SubSurface> sub_surface2(
34 new SubSurface(surface2.get(), parent.get()));
35
36 sub_surface2->PlaceAbove(parent.get());
37 sub_surface1->PlaceAbove(non_sibling_surface.get()); // Invalid
38 sub_surface1->PlaceAbove(surface1.get()); // Invalid
39 sub_surface1->PlaceAbove(surface2.get());
40 parent->Commit();
41 }
42
43 TEST_F(SubSurfaceTest, PlaceBelow) {
44 scoped_ptr<Surface> parent(new Surface);
45 scoped_ptr<Surface> surface1(new Surface);
46 scoped_ptr<Surface> surface2(new Surface);
47 scoped_ptr<Surface> non_sibling_surface(new Surface);
48 scoped_ptr<SubSurface> sub_surface1(
49 new SubSurface(surface1.get(), parent.get()));
50 scoped_ptr<SubSurface> sub_surface2(
51 new SubSurface(surface2.get(), parent.get()));
52
53 sub_surface2->PlaceBelow(parent.get()); // Invalid
54 sub_surface2->PlaceBelow(non_sibling_surface.get()); // Invalid
55 sub_surface2->PlaceBelow(surface1.get());
56 sub_surface1->PlaceBelow(surface2.get());
57 parent->Commit();
58 }
59
60 } // namespace
61 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698