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

Side by Side Diff: ash/display/display_layout_builder_unittest.cc

Issue 1819533002: Convert ScopedVector<DisplayPlacement> to std::vector<DisplayPlacement> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@jsonrefactor
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « ash/display/display_layout_builder.cc ('k') | ash/display/display_layout_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ash/display/display_layout_builder.h" 5 #include "ash/display/display_layout_builder.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace ash { 9 namespace ash {
10 10
11 typedef testing::Test DisplayLayoutBuilderTest; 11 typedef testing::Test DisplayLayoutBuilderTest;
12 12
13 TEST_F(DisplayLayoutBuilderTest, SecondaryPlacement) { 13 TEST_F(DisplayLayoutBuilderTest, SecondaryPlacement) {
14 DisplayLayoutBuilder builder(1); 14 DisplayLayoutBuilder builder(1);
15 builder.SetSecondaryPlacement(2, DisplayPlacement::LEFT, 30); 15 builder.SetSecondaryPlacement(2, DisplayPlacement::LEFT, 30);
16 scoped_ptr<DisplayLayout> layout(builder.Build()); 16 scoped_ptr<DisplayLayout> layout(builder.Build());
17 ASSERT_EQ(1u, layout->placement_list.size()); 17 ASSERT_EQ(1u, layout->placement_list.size());
18 18
19 EXPECT_EQ(2, layout->placement_list[0]->display_id); 19 EXPECT_EQ(2, layout->placement_list[0].display_id);
20 EXPECT_EQ(1, layout->placement_list[0]->parent_display_id); 20 EXPECT_EQ(1, layout->placement_list[0].parent_display_id);
21 EXPECT_EQ(30, layout->placement_list[0]->offset); 21 EXPECT_EQ(30, layout->placement_list[0].offset);
22 EXPECT_EQ(DisplayPlacement::LEFT, layout->placement_list[0]->position); 22 EXPECT_EQ(DisplayPlacement::LEFT, layout->placement_list[0].position);
23 } 23 }
24 24
25 TEST_F(DisplayLayoutBuilderTest, MultiplePlacement) { 25 TEST_F(DisplayLayoutBuilderTest, MultiplePlacement) {
26 DisplayLayoutBuilder builder(1); 26 DisplayLayoutBuilder builder(1);
27 builder.AddDisplayPlacement(5, 1, DisplayPlacement::TOP, 30); 27 builder.AddDisplayPlacement(5, 1, DisplayPlacement::TOP, 30);
28 builder.AddDisplayPlacement(3, 5, DisplayPlacement::LEFT, 20); 28 builder.AddDisplayPlacement(3, 5, DisplayPlacement::LEFT, 20);
29 builder.AddDisplayPlacement(4, 5, DisplayPlacement::RIGHT, 10); 29 builder.AddDisplayPlacement(4, 5, DisplayPlacement::RIGHT, 10);
30 scoped_ptr<DisplayLayout> layout(builder.Build()); 30 scoped_ptr<DisplayLayout> layout(builder.Build());
31 31
32 ASSERT_EQ(3u, layout->placement_list.size()); 32 ASSERT_EQ(3u, layout->placement_list.size());
33 33
34 // placmenets are sorted by display_id. 34 // placmenets are sorted by display_id.
35 EXPECT_EQ(3, layout->placement_list[0]->display_id); 35 EXPECT_EQ(3, layout->placement_list[0].display_id);
36 EXPECT_EQ(5, layout->placement_list[0]->parent_display_id); 36 EXPECT_EQ(5, layout->placement_list[0].parent_display_id);
37 EXPECT_EQ(20, layout->placement_list[0]->offset); 37 EXPECT_EQ(20, layout->placement_list[0].offset);
38 EXPECT_EQ(DisplayPlacement::LEFT, layout->placement_list[0]->position); 38 EXPECT_EQ(DisplayPlacement::LEFT, layout->placement_list[0].position);
39 39
40 EXPECT_EQ(4, layout->placement_list[1]->display_id); 40 EXPECT_EQ(4, layout->placement_list[1].display_id);
41 EXPECT_EQ(5, layout->placement_list[1]->parent_display_id); 41 EXPECT_EQ(5, layout->placement_list[1].parent_display_id);
42 EXPECT_EQ(10, layout->placement_list[1]->offset); 42 EXPECT_EQ(10, layout->placement_list[1].offset);
43 EXPECT_EQ(DisplayPlacement::RIGHT, layout->placement_list[1]->position); 43 EXPECT_EQ(DisplayPlacement::RIGHT, layout->placement_list[1].position);
44 44
45 EXPECT_EQ(5, layout->placement_list[2]->display_id); 45 EXPECT_EQ(5, layout->placement_list[2].display_id);
46 EXPECT_EQ(1, layout->placement_list[2]->parent_display_id); 46 EXPECT_EQ(1, layout->placement_list[2].parent_display_id);
47 EXPECT_EQ(30, layout->placement_list[2]->offset); 47 EXPECT_EQ(30, layout->placement_list[2].offset);
48 EXPECT_EQ(DisplayPlacement::TOP, layout->placement_list[2]->position); 48 EXPECT_EQ(DisplayPlacement::TOP, layout->placement_list[2].position);
49 } 49 }
50 50
51 } // namespace ash 51 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_layout_builder.cc ('k') | ash/display/display_layout_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698