blob: b2e179cfffb12423be9071a7290e54796d71880e [file] [log] [blame]
halcanary@google.com1f0121a2013-11-06 15:07:44 +00001/*
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"
9#include "TestClassDef.h"
10
11SK_CONF_DECLARE(int, c_RTConfTestVariable,
12 "test.utils.rtconf.testVariable", 1,
13 "This is only a test. Do not be alarmed.");
14// TODO(skia-team): more comprehensive unit tests of the SkRTConf
15// system.
16DEF_TEST(RuntimeConfig, reporter) {
17 REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable);
18
19 SK_CONF_SET("test.utils.rtconf.testVariable", 2);
20#ifdef SK_DEVELOPER
21 REPORTER_ASSERT(reporter, 2 == c_RTConfTestVariable);
22#else // not SK_DEVELOPER
23 // Can not change RTConf variables in Release.
24 REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable);
25#endif // SK_DEVELOPER
26
27 // This should not give a warning.
28 SK_CONF_TRY_SET("test.utils.rtconf.nonexistentVariable", 7);
29}