Flutter Engine
The Flutter Engine
third_party
skia
tests
SkEnumBitMaskTest.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2019 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
#include "
src/base/SkEnumBitMask.h
"
9
#include "
tests/Test.h
"
10
11
enum class
Flags
{
12
kNone = 0,
13
kA = 1,
14
kB = 2,
15
kC = 4
16
};
17
SK_MAKE_BITMASK_OPS
(
Flags
)
18
19
DEF_TEST
(skgpu_Mask, r) {
20
SkEnumBitMask<Flags>
flags
=
Flags::kNone
;
21
REPORTER_ASSERT
(r, !
flags
);
22
flags
|=
Flags::kA
;
23
REPORTER_ASSERT
(r,
flags
);
24
REPORTER_ASSERT
(r, !(
flags
&
Flags::kB
));
25
REPORTER_ASSERT
(r, (
flags
&
Flags::kA
));
26
flags
|= (
Flags::kB
|
Flags::kC
);
27
auto
mask =
Flags::kB
|
Flags::kC
;
28
REPORTER_ASSERT
(r, (
flags
& mask) == mask);
29
REPORTER_ASSERT
(r,
flags
== (
Flags::kA
|
Flags::kB
|
Flags::kC
));
30
flags
&=
~Flags
::kC;
31
REPORTER_ASSERT
(r,
flags
== (
Flags::kA
|
Flags::kB
));
32
REPORTER_ASSERT
(r, (
flags
& mask) != mask);
33
REPORTER_ASSERT
(r, (
flags
& mask) !=
Flags::kNone
);
34
REPORTER_ASSERT
(r, (
flags
& mask));
35
REPORTER_ASSERT
(r,
flags
);
36
flags
&=
~Flags
::kB;
37
REPORTER_ASSERT
(r, (
flags
& mask) ==
Flags::kNone
);
38
REPORTER_ASSERT
(r, !(
flags
& mask));
39
REPORTER_ASSERT
(r,
flags
);
40
flags
= (
flags
|
flags
) ^ (
flags
);
41
REPORTER_ASSERT
(r, !
flags
);
42
flags
^= mask;
43
REPORTER_ASSERT
(r,
flags
== mask);
44
REPORTER_ASSERT
(r, !(
Flags::kA
&
Flags::kB
));
45
REPORTER_ASSERT
(r, (
Flags::kA
^
Flags::kB
) == (
Flags::kA
|
Flags::kB
));
46
}
Flags
Flags
Definition:
HairlinePathBench.cpp:16
DEF_TEST
DEF_TEST(skgpu_Mask, r)
Definition:
SkEnumBitMaskTest.cpp:19
Flags::kA
@ kA
Flags::kNone
@ kNone
Flags::kB
@ kB
Flags::kC
@ kC
SkEnumBitMask.h
SK_MAKE_BITMASK_OPS
#define SK_MAKE_BITMASK_OPS(E)
Definition:
SkEnumBitMask.h:68
Test.h
REPORTER_ASSERT
#define REPORTER_ASSERT(r, cond,...)
Definition:
Test.h:286
SkEnumBitMask< Flags >
flags
FlutterSemanticsFlag flags
Definition:
fl_accessible_node.cc:106
Generated on Sun Jun 23 2024 21:56:47 for Flutter Engine by
1.9.4