Flutter Engine
The Flutter Engine
InfRectTest.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
12#include "tests/Test.h"
13
14#include <array>
15#include <cstddef>
16
20 rect.setLTRB(l, t, r, b);
21 REPORTER_ASSERT(reporter, !rect.isFinite());
22}
23
24// Tests that isFinite() will reject any rect with +/-inf values
25// as one of its coordinates.
26DEF_TEST(InfRect, reporter) {
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}
46
47// need tests for SkStrSearch
static bool invalid(const SkISize &size)
reporter
Definition: FontMgrTest.cpp:39
static void check_invalid(skiatest::Reporter *reporter, SkScalar l, SkScalar t, SkScalar r, SkScalar b)
Definition: InfRectTest.cpp:17
DEF_TEST(InfRect, reporter)
Definition: InfRectTest.cpp:26
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
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
float SkScalar
Definition: extension.cpp:12
static bool b
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
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