2013-08-14 18:14:37 +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.
|
|
|
|
*/
|
|
|
|
|
2013-12-12 21:11:12 +00:00
|
|
|
#include "SkRTConf.h"
|
2014-01-24 20:56:26 +00:00
|
|
|
#include "Test.h"
|
2013-08-14 18:14:37 +00:00
|
|
|
|
2014-08-12 16:03:16 +00:00
|
|
|
// Friended proxy for SkRTConfRegistry::parse()
|
|
|
|
template <typename T>
|
|
|
|
bool test_rt_conf_parse(SkRTConfRegistry* reg, const char* key, T* value) {
|
|
|
|
return reg->parse(key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void portable_setenv(const char* key, const char* value) {
|
|
|
|
#ifdef SK_BUILD_FOR_WIN32
|
|
|
|
_putenv_s(key, value);
|
|
|
|
#else
|
|
|
|
setenv(key, value, 1);
|
2013-08-14 18:14:37 +00:00
|
|
|
#endif
|
|
|
|
}
|
2014-08-12 16:03:16 +00:00
|
|
|
|
|
|
|
DEF_TEST(SkRTConfRegistry, reporter) {
|
|
|
|
SkRTConfRegistry reg;
|
|
|
|
|
|
|
|
portable_setenv("skia_nonexistent_item", "132");
|
|
|
|
int result = 0;
|
|
|
|
test_rt_conf_parse(®, "nonexistent.item", &result);
|
|
|
|
REPORTER_ASSERT(reporter, result == 132);
|
|
|
|
}
|