| halcanary@google.com | 1f0121a | 2013-11-06 15:07:44 +0000 | [diff] [blame] | 1 | /* | 
 | 2 |  * Copyright 2013 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 | #include "SkRTConf.h" | 
 | 8 | #include "Test.h" | 
| halcanary@google.com | 1f0121a | 2013-11-06 15:07:44 +0000 | [diff] [blame] | 9 |  | 
 | 10 | SK_CONF_DECLARE(int, c_RTConfTestVariable, | 
 | 11 |                 "test.utils.rtconf.testVariable", 1, | 
 | 12 |                 "This is only a test. Do not be alarmed."); | 
 | 13 | // TODO(skia-team): more comprehensive unit tests of the SkRTConf | 
 | 14 | // system. | 
 | 15 | DEF_TEST(RuntimeConfig, reporter) { | 
 | 16 |     REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable); | 
 | 17 |  | 
 | 18 |     SK_CONF_SET("test.utils.rtconf.testVariable", 2); | 
| djsollen | efe46d2 | 2016-04-29 06:41:35 -0700 | [diff] [blame] | 19 | #ifdef SK_DEBUG | 
| halcanary@google.com | 1f0121a | 2013-11-06 15:07:44 +0000 | [diff] [blame] | 20 |     REPORTER_ASSERT(reporter, 2 == c_RTConfTestVariable); | 
| djsollen | efe46d2 | 2016-04-29 06:41:35 -0700 | [diff] [blame] | 21 | #else  // not SK_DEBUG | 
 | 22 |     // Can not change RTConf variables in SK_RELEASE. | 
| halcanary@google.com | 1f0121a | 2013-11-06 15:07:44 +0000 | [diff] [blame] | 23 |     REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable); | 
| djsollen | efe46d2 | 2016-04-29 06:41:35 -0700 | [diff] [blame] | 24 | #endif  // SK_DEBUG | 
| halcanary@google.com | 1f0121a | 2013-11-06 15:07:44 +0000 | [diff] [blame] | 25 |  | 
 | 26 |     // This should not give a warning. | 
 | 27 |     SK_CONF_TRY_SET("test.utils.rtconf.nonexistentVariable", 7); | 
 | 28 | } |