2013-11-06 15:07:44 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
|
|
|
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);
|
2016-04-29 13:41:35 +00:00
|
|
|
#ifdef SK_DEBUG
|
2013-11-06 15:07:44 +00:00
|
|
|
REPORTER_ASSERT(reporter, 2 == c_RTConfTestVariable);
|
2016-04-29 13:41:35 +00:00
|
|
|
#else // not SK_DEBUG
|
|
|
|
// Can not change RTConf variables in SK_RELEASE.
|
2013-11-06 15:07:44 +00:00
|
|
|
REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable);
|
2016-04-29 13:41:35 +00:00
|
|
|
#endif // SK_DEBUG
|
2013-11-06 15:07:44 +00:00
|
|
|
|
|
|
|
// This should not give a warning.
|
|
|
|
SK_CONF_TRY_SET("test.utils.rtconf.nonexistentVariable", 7);
|
|
|
|
}
|