Flutter Engine
The Flutter Engine
third_party
skia
tests
SizeTest.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2011 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#include "
include/core/SkScalar.h
"
9
#include "
include/core/SkSize.h
"
10
#include "
tests/Test.h
"
11
12
DEF_TEST
(
ISize
,
reporter
) {
13
SkISize
a
,
b
;
14
15
a
.set(0, 0);
16
REPORTER_ASSERT
(
reporter
,
a
.isEmpty());
17
a
.set(5, -5);
18
REPORTER_ASSERT
(
reporter
,
a
.isEmpty());
19
a
=
SkISize
{5, 0};
20
REPORTER_ASSERT
(
reporter
,
a
.isEmpty());
21
b
.set(5, 0);
22
REPORTER_ASSERT
(
reporter
,
a
==
b
);
23
24
a
.set(3, 5);
25
REPORTER_ASSERT
(
reporter
, !
a
.isEmpty());
26
b
=
a
;
27
REPORTER_ASSERT
(
reporter
, !
b
.isEmpty());
28
REPORTER_ASSERT
(
reporter
,
a
==
b
);
29
REPORTER_ASSERT
(
reporter
, !(
a
!=
b
));
30
REPORTER_ASSERT
(
reporter
,
31
a
.fWidth ==
b
.fWidth &&
a
.fHeight ==
b
.fHeight);
32
}
33
34
DEF_TEST
(
Size
,
reporter
) {
35
SkSize
a
,
b
;
36
int
ix = 5;
37
int
iy = 3;
38
SkScalar
x
=
SkIntToScalar
(ix);
39
SkScalar
y
=
SkIntToScalar
(iy);
40
41
a
.set(0, 0);
42
REPORTER_ASSERT
(
reporter
,
a
.isEmpty());
43
a
.set(
x
, -
x
);
44
REPORTER_ASSERT
(
reporter
,
a
.isEmpty());
45
a
=
SkSize
{
x
, 0};
46
REPORTER_ASSERT
(
reporter
,
a
.isEmpty());
47
b
.set(
x
, 0);
48
REPORTER_ASSERT
(
reporter
,
a
==
b
);
49
50
a
.set(
y
,
x
);
51
REPORTER_ASSERT
(
reporter
, !
a
.isEmpty());
52
b
=
a
;
53
REPORTER_ASSERT
(
reporter
, !
b
.isEmpty());
54
REPORTER_ASSERT
(
reporter
,
a
==
b
);
55
REPORTER_ASSERT
(
reporter
, !(
a
!=
b
));
56
REPORTER_ASSERT
(
reporter
,
57
a
.fWidth ==
b
.fWidth &&
a
.fHeight ==
b
.fHeight);
58
59
SkISize
ia;
60
ia.
set
(ix, iy);
61
a
.set(
x
,
y
);
62
REPORTER_ASSERT
(
reporter
,
a
.toRound() == ia);
63
}
reporter
reporter
Definition:
FontMgrTest.cpp:39
DEF_TEST
DEF_TEST(ISize, reporter)
Definition:
SizeTest.cpp:12
SkScalar.h
SkIntToScalar
#define SkIntToScalar(x)
Definition:
SkScalar.h:57
SkSize.h
Test.h
REPORTER_ASSERT
#define REPORTER_ASSERT(r, cond,...)
Definition:
Test.h:286
SkScalar
float SkScalar
Definition:
extension.cpp:12
b
static bool b
Definition:
ffi_native_test_module.c:74
a
struct MyStruct a[10]
y
double y
Definition:
mouse-input-test.cc:83
x
double x
Definition:
mouse-input-test.cc:82
impeller::Size
TSize< Scalar > Size
Definition:
size.h:137
impeller::ISize
ISize64 ISize
Definition:
size.h:140
SkISize
Definition:
SkSize.h:16
SkISize::set
void set(int32_t w, int32_t h)
Definition:
SkSize.h:24
SkSize
Definition:
SkSize.h:52
Generated on Sun Jun 23 2024 21:56:47 for Flutter Engine by
1.9.4