Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
10#include "tests/Test.h"
11
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}
33
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}
reporter
#define SkIntToScalar(x)
Definition SkScalar.h:57
#define DEF_TEST(name, reporter)
Definition Test.h:312
#define REPORTER_ASSERT(r, cond,...)
Definition Test.h:286
float SkScalar
Definition extension.cpp:12
static bool b
struct MyStruct a[10]
double y
double x
void set(int32_t w, int32_t h)
Definition SkSize.h:24