Flutter Engine
The Flutter Engine
Functions
SizeTest.cpp File Reference
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "tests/Test.h"

Go to the source code of this file.

Functions

 DEF_TEST (ISize, reporter)
 
 DEF_TEST (Size, reporter)
 

Function Documentation

◆ DEF_TEST() [1/2]

DEF_TEST ( ISize  ,
reporter   
)

Definition at line 12 of file SizeTest.cpp.

12 {
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);
23
24 a.set(3, 5);
25 REPORTER_ASSERT(reporter, !a.isEmpty());
26 b = a;
27 REPORTER_ASSERT(reporter, !b.isEmpty());
31 a.fWidth == b.fWidth && a.fHeight == b.fHeight);
32}
reporter
Definition: FontMgrTest.cpp:39
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
static bool b
struct MyStruct a[10]
Definition: SkSize.h:16

◆ DEF_TEST() [2/2]

DEF_TEST ( Size  ,
reporter   
)

Definition at line 34 of file SizeTest.cpp.

34 {
35 SkSize a, b;
36 int ix = 5;
37 int iy = 3;
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);
49
50 a.set(y, x);
51 REPORTER_ASSERT(reporter, !a.isEmpty());
52 b = a;
53 REPORTER_ASSERT(reporter, !b.isEmpty());
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}
#define SkIntToScalar(x)
Definition: SkScalar.h:57
float SkScalar
Definition: extension.cpp:12
double y
double x
void set(int32_t w, int32_t h)
Definition: SkSize.h:24
Definition: SkSize.h:52