Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
geometry_unittests.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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 "flutter/shell/platform/common/geometry.h"
6
7#include "gtest/gtest.h"
8
9namespace flutter {
10
11TEST(Point, SetsCoordinates) {
12 Point point(-30.0, 42.0);
13 EXPECT_DOUBLE_EQ(-30.0, point.x());
14 EXPECT_DOUBLE_EQ(42.0, point.y());
15}
16
17TEST(Size, SetsDimensions) {
18 Size size(20.0, 42.0);
19 EXPECT_DOUBLE_EQ(20.0, size.width());
20 EXPECT_DOUBLE_EQ(42.0, size.height());
21}
22
23TEST(Size, ClampsDimensionsPositive) {
24 Size size(-20.0, -42.0);
25 EXPECT_DOUBLE_EQ(0.0, size.width());
26 EXPECT_DOUBLE_EQ(0.0, size.height());
27}
28
29TEST(Rect, SetsOriginAndSize) {
30 Point origin(-30.0, 42.0);
31 Size size(20.0, 22.0);
32 Rect rect(origin, size);
33 EXPECT_EQ(origin, rect.origin());
34 EXPECT_EQ(size, rect.size());
35}
36
37TEST(Rect, ReturnsLTRB) {
38 Point origin(-30.0, 42.0);
39 Size size(20.0, 22.0);
40 Rect rect(origin, size);
41 EXPECT_DOUBLE_EQ(-30.0, rect.left());
42 EXPECT_DOUBLE_EQ(42.0, rect.top());
43 EXPECT_DOUBLE_EQ(-10.0, rect.right());
44 EXPECT_DOUBLE_EQ(64.0, rect.bottom());
45}
46
47TEST(Rect, ReturnsWidthHeight) {
48 Point origin(-30.0, 42.0);
49 Size size(20.0, 22.0);
50 Rect rect(origin, size);
51 EXPECT_DOUBLE_EQ(20.0, rect.width());
52 EXPECT_DOUBLE_EQ(22.0, rect.height());
53}
54
55} // namespace flutter
#define TEST(S, s, D, expected)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259