#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkDebug.h"
#include "src/core/SkPointPriv.h"
#include "tests/Test.h"
#include <cfloat>
#include <cstdint>
#include <cstring>
#include <string>
Go to the source code of this file.
◆ DEF_TEST() [1/2]
Definition at line 132 of file PointTest.cpp.
132 {
134
135 static const struct {
142 };
143
144 for (
size_t i = 0; i < std::size(
gRec); ++i) {
146 }
147
150}
static const struct @223 gRec[]
static void test_overflow(skiatest::Reporter *reporter)
static void test_normalize_cannormalize_consistent(skiatest::Reporter *reporter)
static void test_length(skiatest::Reporter *reporter, SkScalar x, SkScalar y, SkScalar expectedLength)
static void test_casts(skiatest::Reporter *reporter)
◆ DEF_TEST() [2/2]
DEF_TEST |
( |
Point_setLengthFast |
, |
|
|
reporter |
|
|
) |
| |
Definition at line 152 of file PointTest.cpp.
152 {
153
154
155 const float tests[] = { 1.0f, 0.0f, 1.0e-37f, 3.4e38f, 42.0f, 0.00012f };
156
158 for (
unsigned i = 0; i < std::size(
tests); i++) {
160
163
164 if (slow.
length() < FLT_MIN && fast.length() < FLT_MIN)
continue;
165
169 }
170}
#define REPORTER_ASSERT(r, cond,...)
static bool SetLengthFast(SkPoint *pt, float length)
bool setLength(float length)
◆ force_as_float()
Definition at line 96 of file PointTest.cpp.
96 {
97 uint32_t storage;
98 memcpy(&storage, &value, 4);
99
100
101
103 storage = ~storage;
104 }
105 memcpy(&value, &storage, 4);
107}
◆ get_value()
◆ test_casts()
Definition at line 21 of file PointTest.cpp.
21 {
24
27
30}
static const SkScalar * AsScalars(const SkPoint &pt)
const float * asScalars() const
◆ test_length()
Definition at line 64 of file PointTest.cpp.
65 {
70
71
74
76}
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
void set(float x, float y)
static float Length(float x, float y)
static void test_Normalize(skiatest::Reporter *reporter, SkScalar x, SkScalar y)
◆ test_Normalize()
Definition at line 33 of file PointTest.cpp.
34 {
42}
static float Normalize(SkVector *vec)
◆ test_normalize_cannormalize_consistent()
Definition at line 44 of file PointTest.cpp.
44 {
46
49
51 const SkPoint pts[] = { { 0, v }, { v, 0 }, { 1, v }, { v, 1 }, { v, v } };
52
55 bool nor =
p.normalize();
57 }
58 }
59 }
60}
#define SkScalarInvert(x)
#define SK_ScalarInfinity
static bool CanNormalize(SkScalar dx, SkScalar dy)
◆ test_overflow()
Definition at line 111 of file PointTest.cpp.
111 {
113 SkPoint pt = { bigFloat, bigFloat };
114
117
118
122 }
123
124
126
127
130}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool SkIsFinite(T x, Pack... values)
T get_value(skiatest::Reporter *reporter, T value)
static float force_as_float(skiatest::Reporter *reporter, float value)