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

Side by Side Diff: ui/app_list/apps_grid_view_unittest.cc

Issue 10386224: app_list: Add search box and search result view for v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/app_list/app_list_model_view.h" 5 #include "ui/app_list/apps_grid_view.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/app_list/app_list_item_view.h" 8 #include "ui/app_list/app_list_item_view.h"
9 9
10 namespace { 10 namespace {
11 11
12 struct ModelViewCalculateLayoutCase { 12 struct ModelViewCalculateLayoutCase {
13 gfx::Size screen_size; 13 gfx::Size screen_size;
14 int num_of_tiles; 14 int num_of_tiles;
15 gfx::Size expected_icon_size; 15 gfx::Size expected_icon_size;
16 int expected_rows; 16 int expected_rows;
17 int expected_cols; 17 int expected_cols;
18 }; 18 };
19 19
20 } // namespace 20 } // namespace
21 21
22 namespace app_list { 22 namespace app_list {
23 23
24 TEST(AppListModelViewTest, ModelViewCalculateLayout) { 24 TEST(AppsGridViewTest, ModelViewCalculateLayout) {
25 // kMinTitleWidth is the average width of 15 chars of default size 12 font in 25 // kMinTitleWidth is the average width of 15 chars of default size 12 font in
26 // chromeos. Override here to avoid flakiness from different default font on 26 // chromeos. Override here to avoid flakiness from different default font on
27 // bots. 27 // bots.
28 const int kMinTitleWidth = 90; 28 const int kMinTitleWidth = 90;
29 AppListItemView::SetMinTitleWidth(kMinTitleWidth); 29 AppListItemView::SetMinTitleWidth(kMinTitleWidth);
30 30
31 const int kLauncherHeight = 50; 31 const int kLauncherHeight = 50;
32 const ModelViewCalculateLayoutCase kCases[] = { 32 const ModelViewCalculateLayoutCase kCases[] = {
33 { gfx::Size(1024, 768), 4, gfx::Size(128, 128), 2, 3 }, 33 { gfx::Size(1024, 768), 4, gfx::Size(128, 128), 2, 3 },
34 { gfx::Size(1024, 768), 29, gfx::Size(64, 64), 5, 6 }, 34 { gfx::Size(1024, 768), 29, gfx::Size(64, 64), 5, 6 },
(...skipping 13 matching lines...) Expand all
48 { gfx::Size(1024, 768), 50, gfx::Size(32, 32), 6, 9 }, 48 { gfx::Size(1024, 768), 50, gfx::Size(32, 32), 6, 9 },
49 { gfx::Size(1280, 1024), 100, gfx::Size(32, 32), 10, 11 }, 49 { gfx::Size(1280, 1024), 100, gfx::Size(32, 32), 10, 11 },
50 }; 50 };
51 51
52 for (size_t i = 0; i < arraysize(kCases); ++i) { 52 for (size_t i = 0; i < arraysize(kCases); ++i) {
53 gfx::Size icon_size; 53 gfx::Size icon_size;
54 int rows = 0; 54 int rows = 0;
55 int cols = 0; 55 int cols = 0;
56 gfx::Size content_size(kCases[i].screen_size.width(), 56 gfx::Size content_size(kCases[i].screen_size.width(),
57 kCases[i].screen_size.height() - kLauncherHeight); 57 kCases[i].screen_size.height() - kLauncherHeight);
58 AppListModelView::CalculateLayout(content_size, 58 AppsGridView::CalculateLayout(content_size,
59 kCases[i].num_of_tiles, 59 kCases[i].num_of_tiles,
60 &icon_size, 60 &icon_size,
61 &rows, 61 &rows,
62 &cols); 62 &cols);
63 EXPECT_EQ(kCases[i].expected_icon_size, icon_size) << "i=" << i; 63 EXPECT_EQ(kCases[i].expected_icon_size, icon_size) << "i=" << i;
64 EXPECT_EQ(kCases[i].expected_rows, rows) << "i=" << i; 64 EXPECT_EQ(kCases[i].expected_rows, rows) << "i=" << i;
65 EXPECT_EQ(kCases[i].expected_cols, cols) << "i=" << i; 65 EXPECT_EQ(kCases[i].expected_cols, cols) << "i=" << i;
66 } 66 }
67 } 67 }
68 68
69 } // namespace app_list 69 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698