Chromium Code Reviews| Index: tests/RuntimeConfigTest.cpp |
| diff --git a/tests/RuntimeConfigTest.cpp b/tests/RuntimeConfigTest.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b1a46951027e42b20a243ba4cb6cd1a708eb4975 |
| --- /dev/null |
| +++ b/tests/RuntimeConfigTest.cpp |
| @@ -0,0 +1,27 @@ |
| +/* |
| + * Copyright 2013 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| +#include "SkRTConf.h" |
| +#include "Test.h" |
| +#include "TestClassDef.h" |
| + |
| +SK_CONF_DECLARE(int, c_RTConfTestVariable, |
| + "test.utils.rtconf.testVariable", 1, |
| + "This is only a test. Do not be alarmed."); |
| +// TODO(skia-team): more comprehensive unit tests of the SkRTConf |
| +// system. |
| +DEF_TEST(RuntimeConfig, reporter) { |
| + REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable); |
| + SK_CONF_SET("test.utils.rtconf.testVariable", 2); |
| + #ifdef SK_DEVELOPER |
|
caryclark
2013/11/01 16:57:36
I find this difficult to parse. Maybe outdent the
hal.canary
2013/11/01 17:01:18
Done.
|
| + REPORTER_ASSERT(reporter, 2 == c_RTConfTestVariable); |
| + #else // not SK_DEVELOPER |
| + // Can not change RTConf variables in Release. |
| + REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable); |
| + #endif // SK_DEVELOPER |
| + // This should not give a warning. |
| + SK_CONF_TRY_SET("test.utils.rtconf.nonexistentVariable", 7); |
| +} |