This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 4 files changed +38
-2
lines changed 4 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,10 @@ impeller_component("base") {
32
32
33
33
impeller_component (" base_unittests" ) {
34
34
testonly = true
35
- sources = [ " base_unittests.cc" ]
35
+ sources = [
36
+ " base_unittests.cc" ,
37
+ " validation_unittests.cc" ,
38
+ ]
36
39
deps = [
37
40
" :base" ,
38
41
" //flutter/testing" ,
Original file line number Diff line number Diff line change 11
11
namespace impeller {
12
12
13
13
static std::atomic_int32_t sValidationLogsDisabledCount = 0 ;
14
- static std::atomic_int32_t sValidationLogsAreFatal = 0 ;
14
+ static std::atomic_int32_t sValidationLogsAreFatal = 1 ;
15
15
16
16
void ImpellerValidationErrorsSetFatal (bool fatal) {
17
17
sValidationLogsAreFatal = fatal;
@@ -59,4 +59,15 @@ void ImpellerValidationBreak(const char* message) {
59
59
#endif // IMPELLER_ENABLE_VALIDATION
60
60
}
61
61
62
+ bool ImpellerValidationErrorsIsFatal () {
63
+ return sValidationLogsAreFatal ;
64
+ }
65
+
66
+ bool ImpellerValidationIsEnabled () {
67
+ #ifdef IMPELLER_ENABLE_VALIDATION
68
+ return true ;
69
+ #else
70
+ return false ;
71
+ #endif
72
+ }
62
73
} // namespace impeller
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ void ImpellerValidationBreak(const char* message);
39
39
40
40
void ImpellerValidationErrorsSetFatal (bool fatal);
41
41
42
+ bool ImpellerValidationErrorsIsFatal ();
43
+
44
+ bool ImpellerValidationIsEnabled ();
45
+
42
46
struct ScopedValidationDisable {
43
47
ScopedValidationDisable ();
44
48
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Flutter Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #include " flutter/testing/testing.h"
6
+ #include " impeller/base/validation.h"
7
+
8
+ namespace impeller {
9
+
10
+ TEST (ValidationTest, IsFatal) {
11
+ EXPECT_TRUE (ImpellerValidationErrorsIsFatal ());
12
+ }
13
+
14
+ TEST (ValidationTest, IsEnabled) {
15
+ EXPECT_TRUE (ImpellerValidationIsEnabled ());
16
+ }
17
+
18
+ } // namespace impeller
You can’t perform that action at this time.
0 commit comments