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

Side by Side Diff: ui/views/layout/grid_layout_unittest.cc

Issue 679233002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « ui/views/layout/grid_layout.cc ('k') | ui/views/linux_ui/linux_ui.h » ('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 (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/views/layout/grid_layout.h" 5 #include "ui/views/layout/grid_layout.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 10
11 namespace views { 11 namespace views {
12 12
13 void ExpectViewBoundsEquals(int x, int y, int w, int h, 13 void ExpectViewBoundsEquals(int x, int y, int w, int h,
14 const View* view) { 14 const View* view) {
15 EXPECT_EQ(x, view->x()); 15 EXPECT_EQ(x, view->x());
16 EXPECT_EQ(y, view->y()); 16 EXPECT_EQ(y, view->y());
17 EXPECT_EQ(w, view->width()); 17 EXPECT_EQ(w, view->width());
18 EXPECT_EQ(h, view->height()); 18 EXPECT_EQ(h, view->height());
19 } 19 }
20 20
21 class SettableSizeView : public View { 21 class SettableSizeView : public View {
22 public: 22 public:
23 explicit SettableSizeView(const gfx::Size& pref) { 23 explicit SettableSizeView(const gfx::Size& pref) {
24 pref_ = pref; 24 pref_ = pref;
25 } 25 }
26 26
27 virtual gfx::Size GetPreferredSize() const override { 27 gfx::Size GetPreferredSize() const override { return pref_; }
28 return pref_;
29 }
30 28
31 private: 29 private:
32 gfx::Size pref_; 30 gfx::Size pref_;
33 }; 31 };
34 32
35 // A view with fixed circumference that trades height for width. 33 // A view with fixed circumference that trades height for width.
36 class FlexibleView : public View { 34 class FlexibleView : public View {
37 public: 35 public:
38 explicit FlexibleView(int circumference) { 36 explicit FlexibleView(int circumference) {
39 circumference_ = circumference; 37 circumference_ = circumference;
40 } 38 }
41 39
42 virtual gfx::Size GetPreferredSize() const override { 40 gfx::Size GetPreferredSize() const override {
43 return gfx::Size(0, circumference_ / 2); 41 return gfx::Size(0, circumference_ / 2);
44 } 42 }
45 43
46 virtual int GetHeightForWidth(int width) const override { 44 int GetHeightForWidth(int width) const override {
47 return std::max(0, circumference_ / 2 - width); 45 return std::max(0, circumference_ / 2 - width);
48 } 46 }
49 47
50 private: 48 private:
51 int circumference_; 49 int circumference_;
52 }; 50 };
53 51
54 class GridLayoutTest : public testing::Test { 52 class GridLayoutTest : public testing::Test {
55 public: 53 public:
56 GridLayoutTest() : layout(&host) {} 54 GridLayoutTest() : layout(&host) {}
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 EXPECT_EQ(gfx::Size(10, 20), pref); 658 EXPECT_EQ(gfx::Size(10, 20), pref);
661 659
662 layout.set_minimum_size(gfx::Size(40, 40)); 660 layout.set_minimum_size(gfx::Size(40, 40));
663 GetPreferredSize(); 661 GetPreferredSize();
664 EXPECT_EQ(gfx::Size(40, 40), pref); 662 EXPECT_EQ(gfx::Size(40, 40), pref);
665 663
666 RemoveAll(); 664 RemoveAll();
667 } 665 }
668 666
669 } // namespace views 667 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/layout/grid_layout.cc ('k') | ui/views/linux_ui/linux_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698