Flutter Engine
The Flutter Engine
Functions
InfRectTest.cpp File Reference
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkFloatingPoint.h"
#include "tests/Test.h"
#include <array>
#include <cstddef>

Go to the source code of this file.

Functions

static void check_invalid (skiatest::Reporter *reporter, SkScalar l, SkScalar t, SkScalar r, SkScalar b)
 
 DEF_TEST (InfRect, reporter)
 

Function Documentation

◆ check_invalid()

static void check_invalid ( skiatest::Reporter reporter,
SkScalar  l,
SkScalar  t,
SkScalar  r,
SkScalar  b 
)
static

Definition at line 17 of file InfRectTest.cpp.

18 {
20 rect.setLTRB(l, t, r, b);
21 REPORTER_ASSERT(reporter, !rect.isFinite());
22}
reporter
Definition: FontMgrTest.cpp:39
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
static bool b
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ DEF_TEST()

DEF_TEST ( InfRect  ,
reporter   
)

Definition at line 26 of file InfRectTest.cpp.

26 {
27 float inf = SK_FloatInfinity;
28 float nan = SK_FloatNaN;
29 SkASSERT(!(nan == nan));
30 SkScalar small = SkIntToScalar(10);
31 SkScalar big = SkIntToScalar(100);
32
34
35 SkRect rect = SkRect::MakeXYWH(small, small, big, big);
36 REPORTER_ASSERT(reporter, rect.isFinite());
37
38 const SkScalar invalid[] = { nan, inf, -inf };
39 for (size_t i = 0; i < std::size(invalid); ++i) {
40 check_invalid(reporter, small, small, big, invalid[i]);
41 check_invalid(reporter, small, small, invalid[i], big);
42 check_invalid(reporter, small, invalid[i], big, big);
43 check_invalid(reporter, invalid[i], small, big, big);
44 }
45}
static bool invalid(const SkISize &size)
static void check_invalid(skiatest::Reporter *reporter, SkScalar l, SkScalar t, SkScalar r, SkScalar b)
Definition: InfRectTest.cpp:17
static bool isFinite(const SkRect &r)
Definition: MathBench.cpp:230
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr float SK_FloatInfinity
constexpr float SK_FloatNaN
#define SkIntToScalar(x)
Definition: SkScalar.h:57
float SkScalar
Definition: extension.cpp:12
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition: SkRect.h:659