Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: tests/TestSize.cpp

Issue 337783007: Rename TestSize.cpp to SkSizeTest.cpp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name fixes Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/SizeTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 "SkSize.h"
9 #include "Test.h"
10
11 static void TestISize(skiatest::Reporter* reporter) {
12 SkISize a, b;
13
14 a.set(0, 0);
15 REPORTER_ASSERT(reporter, a.isEmpty());
16 a.set(5, -5);
17 REPORTER_ASSERT(reporter, a.isEmpty());
18 a.clampNegToZero();
19 REPORTER_ASSERT(reporter, a.isEmpty());
20 b.set(5, 0);
21 REPORTER_ASSERT(reporter, a == b);
22
23 a.set(3, 5);
24 REPORTER_ASSERT(reporter, !a.isEmpty());
25 b = a;
26 REPORTER_ASSERT(reporter, !b.isEmpty());
27 REPORTER_ASSERT(reporter, a == b);
28 REPORTER_ASSERT(reporter, !(a != b));
29 REPORTER_ASSERT(reporter,
30 a.fWidth == b.fWidth && a.fHeight == b.fHeight);
31 }
32
33 DEF_TEST(Size, reporter) {
34 TestISize(reporter);
35
36 SkSize a, b;
37 int ix = 5;
38 int iy = 3;
39 SkScalar x = SkIntToScalar(ix);
40 SkScalar y = SkIntToScalar(iy);
41
42 a.set(0, 0);
43 REPORTER_ASSERT(reporter, a.isEmpty());
44 a.set(x, -x);
45 REPORTER_ASSERT(reporter, a.isEmpty());
46 a.clampNegToZero();
47 REPORTER_ASSERT(reporter, a.isEmpty());
48 b.set(x, 0);
49 REPORTER_ASSERT(reporter, a == b);
50
51 a.set(y, x);
52 REPORTER_ASSERT(reporter, !a.isEmpty());
53 b = a;
54 REPORTER_ASSERT(reporter, !b.isEmpty());
55 REPORTER_ASSERT(reporter, a == b);
56 REPORTER_ASSERT(reporter, !(a != b));
57 REPORTER_ASSERT(reporter,
58 a.fWidth == b.fWidth && a.fHeight == b.fHeight);
59
60 SkISize ia;
61 ia.set(ix, iy);
62 a.set(x, y);
63 REPORTER_ASSERT(reporter, a.toRound() == ia);
64 }
OLDNEW
« no previous file with comments | « tests/SizeTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698