/src/mozilla-central/gfx/2d/unittest/TestPoint.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "TestPoint.h" |
8 | | |
9 | | #include "Point.h" |
10 | | |
11 | | using namespace mozilla::gfx; |
12 | | |
13 | | TestPoint::TestPoint() |
14 | 0 | { |
15 | 0 | REGISTER_TEST(TestPoint, Addition); |
16 | 0 | REGISTER_TEST(TestPoint, Subtraction); |
17 | 0 | } |
18 | | |
19 | | void |
20 | | TestPoint::Addition() |
21 | 0 | { |
22 | 0 | Point a, b; |
23 | 0 | a.x = 2; |
24 | 0 | a.y = 2; |
25 | 0 | b.x = 5; |
26 | 0 | b.y = -5; |
27 | 0 |
|
28 | 0 | a += b; |
29 | 0 |
|
30 | 0 | VERIFY(a.x == 7.f); |
31 | 0 | VERIFY(a.y == -3.f); |
32 | 0 | } |
33 | | |
34 | | void |
35 | | TestPoint::Subtraction() |
36 | 0 | { |
37 | 0 | Point a, b; |
38 | 0 | a.x = 2; |
39 | 0 | a.y = 2; |
40 | 0 | b.x = 5; |
41 | 0 | b.y = -5; |
42 | 0 |
|
43 | 0 | a -= b; |
44 | 0 |
|
45 | 0 | VERIFY(a.x == -3.f); |
46 | 0 | VERIFY(a.y == 7.f); |
47 | 0 | } |