This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Expand file tree Collapse file tree 4 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,10 @@ impeller_component("base") {
3232
3333impeller_component (" base_unittests" ) {
3434 testonly = true
35- sources = [ " base_unittests.cc" ]
35+ sources = [
36+ " base_unittests.cc" ,
37+ " validation_unittests.cc" ,
38+ ]
3639 deps = [
3740 " :base" ,
3841 " //flutter/testing" ,
Original file line number Diff line number Diff line change 1111namespace impeller {
1212
1313static std::atomic_int32_t sValidationLogsDisabledCount = 0 ;
14- static std::atomic_int32_t sValidationLogsAreFatal = 0 ;
14+ static std::atomic_int32_t sValidationLogsAreFatal = 1 ;
1515
1616void ImpellerValidationErrorsSetFatal (bool fatal) {
1717 sValidationLogsAreFatal = fatal;
@@ -59,4 +59,15 @@ void ImpellerValidationBreak(const char* message) {
5959#endif // IMPELLER_ENABLE_VALIDATION
6060}
6161
62+ bool ImpellerValidationIsFatal () {
63+ return sValidationLogsAreFatal ;
64+ }
65+
66+ bool ImpellerValidationIsEnabled () {
67+ #ifdef IMPELLER_ENABLE_VALIDATION
68+ return true ;
69+ #else
70+ return false ;
71+ #endif
72+ }
6273} // namespace impeller
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ void ImpellerValidationBreak(const char* message);
3939
4040void ImpellerValidationErrorsSetFatal (bool fatal);
4141
42+ bool ImpellerValidationIsFatal ();
43+
44+ bool ImpellerValidationIsEnabled ();
45+
4246struct ScopedValidationDisable {
4347 ScopedValidationDisable ();
4448
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 (ImpellerValidationIsFatal ());
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