96TEST(InsetsFTest, Operators) {
98 insets.
Set(1.f, 2.5f, 3.3f, 4.1f);
100 EXPECT_FLOAT_EQ(6.8f, insets.
top());
101 EXPECT_FLOAT_EQ(9.2f, insets.
left());
102 EXPECT_FLOAT_EQ(10.9f, insets.
bottom());
103 EXPECT_FLOAT_EQ(12.6f, insets.
right());
106 EXPECT_FLOAT_EQ(7.8f, insets.
top());
107 EXPECT_FLOAT_EQ(9.2f, insets.
left());
108 EXPECT_FLOAT_EQ(9.8f, insets.
bottom());
109 EXPECT_FLOAT_EQ(10.4f, insets.
right());
113 EXPECT_FLOAT_EQ(15.5f, insets.
top());
114 EXPECT_FLOAT_EQ(15.1f, insets.
left());
115 EXPECT_FLOAT_EQ(10.01f, insets.
bottom());
116 EXPECT_FLOAT_EQ(-10.199f, insets.
right());
120 EXPECT_FLOAT_EQ(4.5f, insets.
top());
121 EXPECT_FLOAT_EQ(5.1f, insets.
left());
122 EXPECT_FLOAT_EQ(10.01f, insets.
bottom());
123 EXPECT_FLOAT_EQ(30.201f, insets.
right());
176TEST(InsetsTest, IntegerOverflow) {
177 constexpr int int_min = std::numeric_limits<int>::min();
178 constexpr int int_max = std::numeric_limits<int>::max();
181 EXPECT_EQ(int_max, width_height_test.
width());
182 EXPECT_EQ(int_max, width_height_test.
height());
192 scale_test = scale_test.
Scale(2.f, 2.f);
196TEST(InsetsTest, IntegerUnderflow) {
197 constexpr int int_min = std::numeric_limits<int>::min();
198 constexpr int int_max = std::numeric_limits<int>::max();
201 EXPECT_EQ(int_min, width_height_test.
width());
202 EXPECT_EQ(int_min, width_height_test.
height());
209 scale_test = scale_test.
Scale(2.f, 2.f);
213TEST(InsetsTest, IntegerOverflowSetVariants) {
214 constexpr int int_max = std::numeric_limits<int>::max();
218 EXPECT_EQ(int_max, set_test.
top());
219 EXPECT_EQ(0, set_test.
bottom());
222 EXPECT_EQ(int_max, set_test.
left());
223 EXPECT_EQ(0, set_test.
right());
227 EXPECT_EQ(int_max - 30, set_test.
bottom());
228 EXPECT_EQ(30, set_test.
top());
231 EXPECT_EQ(int_max - 30, set_test.
right());
232 EXPECT_EQ(30, set_test.
left());
235TEST(InsetsTest, IntegerUnderflowSetVariants) {
236 constexpr int int_min = std::numeric_limits<int>::min();
240 EXPECT_EQ(int_min, set_test.
top());
241 EXPECT_EQ(0, set_test.
bottom());
244 EXPECT_EQ(int_min, set_test.
left());
245 EXPECT_EQ(0, set_test.
right());
249 EXPECT_EQ(int_min + 30, set_test.
bottom());
250 EXPECT_EQ(-30, set_test.
top());
253 EXPECT_EQ(int_min + 30, set_test.
right());
254 EXPECT_EQ(-30, set_test.
left());
257TEST(InsetsTest, IntegerOverflowSet) {
258 constexpr int int_max = std::numeric_limits<int>::max();
261 set_all_test.
Set(10, 20, int_max, int_max);
262 EXPECT_EQ(
gfx::Insets(10, 20, int_max - 10, int_max - 20), set_all_test);
265TEST(InsetsTest, IntegerOverflowOffset) {
266 constexpr int int_max = std::numeric_limits<int>::max();
271 EXPECT_EQ(
gfx::Insets(int_max, int_max, 3 - int_max, 4 - int_max),
275TEST(InsetsTest, IntegerUnderflowOffset) {
276 constexpr int int_min = std::numeric_limits<int>::min();
281 EXPECT_EQ(
gfx::Insets(int_min, int_min, -10 - int_min, -10 - int_min),