1 // Copyright 2018 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 "chrome/browser/vr/elements/vector_icon_button.h"
6
7 #include "chrome/browser/vr/elements/rect.h"
8 #include "chrome/browser/vr/elements/vector_icon.h"
9 #include "components/vector_icons/vector_icons.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace vr {
13
TEST(VectorIconButton,CornerRadiiOnResize)14 TEST(VectorIconButton, CornerRadiiOnResize) {
15 VectorIconButton button(base::RepeatingCallback<void()>(),
16 vector_icons::kMicIcon, nullptr);
17 button.SetSize(1.0f, 1.0f);
18 button.SetCornerRadius(0.25f);
19
20 EXPECT_FLOAT_EQ(0.25f, button.corner_radius());
21 // The foreground of vector icons is not not automatically affected by corner
22 // radius.
23 EXPECT_FLOAT_EQ(0.0f, button.foreground()->corner_radius());
24 EXPECT_FLOAT_EQ(0.25f, button.background()->corner_radius());
25 EXPECT_FLOAT_EQ(0.25f, button.hit_plane()->corner_radius());
26
27 button.SetSize(2.0f, 2.0f);
28
29 EXPECT_FLOAT_EQ(0.25f, button.corner_radius());
30 EXPECT_FLOAT_EQ(0.0f, button.foreground()->corner_radius());
31 EXPECT_FLOAT_EQ(0.25f, button.background()->corner_radius());
32 EXPECT_FLOAT_EQ(0.25f, button.hit_plane()->corner_radius());
33 }
34
35 } // namespace vr
36