Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
tests
CtsEnforcement.h
Go to the documentation of this file.
1
/*
2
* Copyright 2022 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
#ifndef CtsEnforcement_DEFINED
9
#define CtsEnforcement_DEFINED
10
11
#include "
include/core/SkTypes.h
"
12
13
#include <climits>
14
#include <cstdint>
15
16
/**
17
* Determines how unit tests are enforced by CTS. Depending on the ApiLevel, a test will be run
18
* in one of 3 states: run without workarounds, run with workarounds or skipped.
19
*/
20
class
CtsEnforcement
{
21
public
:
22
enum
ApiLevel
: int32_t {
23
/* When used as fStrictVersion, always skip this test. It is not relevant to CTS.
24
* When used as fWorkaroundsVersion, there are no api levels that should run the
25
* test with workarounds.
26
*/
27
kNever
= INT32_MAX,
28
/* The kApiLevel_* values are directly correlated with Android API levels. Every new
29
* CTS/SkQP release has a corresponding Android API level that will be captured by these
30
* enum values.
31
*/
32
kApiLevel_T
= 33,
33
kApiLevel_U
= 34,
34
kApiLevel_V
= 35,
35
/* kNextRelease is a placeholder value that all new unit tests should use. It implies that
36
* this test will be enforced in the next Android release. At the time of the release a
37
* new kApiLevel_* value will be added and all current kNextRelease values will be replaced
38
* with that new value.
39
*/
40
kNextRelease
=
kApiLevel_V
41
};
42
43
/**
44
* Tests will run in strict (no workarounds) mode if the device API level is >= strictVersion
45
*/
46
constexpr
CtsEnforcement
(
ApiLevel
strictVersion)
47
: fStrictVersion(strictVersion), fWorkaroundsVersion(
kNever
) {}
48
49
/**
50
* Test will run with workarounds if the device API level is >= workaroundVersion
51
* and < strictVersion
52
*/
53
constexpr
CtsEnforcement
&
withWorkarounds
(
ApiLevel
workaroundVersion) {
54
SkASSERT
(workaroundVersion <= fStrictVersion);
55
fWorkaroundsVersion = workaroundVersion;
56
return
*
this
;
57
}
58
59
enum class
RunMode
{
kSkip
= 0,
kRunWithWorkarounds
= 1,
kRunStrict
= 2 };
60
RunMode
eval
(
int
apiLevel)
const
;
61
62
private
:
63
ApiLevel
fStrictVersion;
64
ApiLevel
fWorkaroundsVersion;
65
};
66
67
#endif
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkTypes.h
CtsEnforcement
Definition
CtsEnforcement.h:20
CtsEnforcement::RunMode
RunMode
Definition
CtsEnforcement.h:59
CtsEnforcement::RunMode::kRunStrict
@ kRunStrict
CtsEnforcement::RunMode::kRunWithWorkarounds
@ kRunWithWorkarounds
CtsEnforcement::RunMode::kSkip
@ kSkip
CtsEnforcement::CtsEnforcement
constexpr CtsEnforcement(ApiLevel strictVersion)
Definition
CtsEnforcement.h:46
CtsEnforcement::ApiLevel
ApiLevel
Definition
CtsEnforcement.h:22
CtsEnforcement::kApiLevel_V
@ kApiLevel_V
Definition
CtsEnforcement.h:34
CtsEnforcement::kNever
@ kNever
Definition
CtsEnforcement.h:27
CtsEnforcement::kNextRelease
@ kNextRelease
Definition
CtsEnforcement.h:40
CtsEnforcement::kApiLevel_T
@ kApiLevel_T
Definition
CtsEnforcement.h:32
CtsEnforcement::kApiLevel_U
@ kApiLevel_U
Definition
CtsEnforcement.h:33
CtsEnforcement::withWorkarounds
constexpr CtsEnforcement & withWorkarounds(ApiLevel workaroundVersion)
Definition
CtsEnforcement.h:53
CtsEnforcement::eval
RunMode eval(int apiLevel) const
Definition
CtsEnforcement.cpp:10
Generated on Fri Apr 26 2024 06:17:40 for Flutter Engine by
1.9.8