diff options
author | mtklein <mtklein@google.com> | 2016-08-03 19:19:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-03 19:19:48 -0700 |
commit | b97963401220da82455e0dfe1f7206e7e8b249e1 (patch) | |
tree | f3415f1aa9e9b89ca3992506de4435b287cf05bb /tests | |
parent | 52d1be5ca7b1ba8cc450be7dd6377ea5bb73386a (diff) |
Revert of SkRTConf: reduce functionality to what we use, increase simplicity (patchset #8 id:150001 of https://codereview.chromium.org/2212473002/ )
Reason for revert:
missed GrVkPipelineStateCache
Original issue's description:
> SkRTConf: reduce functionality to what we use, increase simplicity
>
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2212473002
> DOCS_PREVIEW= https://skia.org/?cl=2212473002
> CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
>
> [mtklein]
> TBR=reed@google.com
> Only removing unused public API.
>
> Committed: https://skia.googlesource.com/skia/+/ef59974708dade6fa72fb0218d4f8a9590175c47
TBR=halcanary@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review-Url: https://codereview.chromium.org/2215433003
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PathOpsExtendedTest.cpp | 5 | ||||
-rw-r--r-- | tests/PathOpsSkpClipTest.cpp | 14 | ||||
-rw-r--r-- | tests/RTConfRegistryTest.cpp | 25 | ||||
-rw-r--r-- | tests/RuntimeConfigTest.cpp | 28 | ||||
-rw-r--r-- | tests/SkpSkGrTest.cpp | 1 |
5 files changed, 72 insertions, 1 deletions
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp index 6ea67fe89f..2f6d99d652 100644 --- a/tests/PathOpsExtendedTest.cpp +++ b/tests/PathOpsExtendedTest.cpp @@ -13,6 +13,7 @@ #include "SkMatrix.h" #include "SkMutex.h" #include "SkPaint.h" +#include "SkRTConf.h" #include "SkStream.h" #include <stdlib.h> @@ -629,6 +630,10 @@ bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& SK_DECLARE_STATIC_MUTEX(gMutex); void initializeTests(skiatest::Reporter* reporter, const char* test) { +#if 0 // doesn't work yet + SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); + SK_CONF_SET("images.png.suppressDecoderWarnings", true); +#endif if (reporter->verbose()) { SkAutoMutexAcquire lock(gMutex); testName = test; diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp index 3c958f1bec..c96e5bf66c 100644 --- a/tests/PathOpsSkpClipTest.cpp +++ b/tests/PathOpsSkpClipTest.cpp @@ -19,6 +19,7 @@ #include "SkOSFile.h" #include "SkPathOpsDebug.h" #include "SkPicture.h" +#include "SkRTConf.h" #include "SkTSort.h" #include "SkStream.h" #include "SkString.h" @@ -26,7 +27,6 @@ #include "SkTDArray.h" #include "SkTaskGroup.h" #include "SkTemplates.h" -#include "SkTSearch.h" #include "SkTime.h" #include <stdlib.h> @@ -740,6 +740,13 @@ checkEarlyExit: return true; } +static void initTest() { +#if !defined SK_BUILD_FOR_WIN && !defined SK_BUILD_FOR_MAC + SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); + SK_CONF_SET("images.png.suppressDecoderWarnings", true); +#endif +} + static void testSkpClipEncode(TestState* data) { data->fResult.testOne(); if (verbose()) { @@ -820,6 +827,7 @@ typedef SkTRegistry<Test*(*)(void*)> TestRegistry; DEF_TEST(PathOpsSkpClip) { gDirs.setDefault(); + initTest(); SkTArray<TestResult, true> errors; TestState state; state.init(0); @@ -843,6 +851,7 @@ static void testSkpClipMain(TestState* data) { DEF_TEST(PathOpsSkpClipThreaded) { gDirs.setDefault(); + initTest(); TestRunner testRunner; int dirNo; gDirs.reset(); @@ -881,6 +890,7 @@ DEF_TEST(PathOpsSkpClipUberThreaded) { gDirs.setDefault(); const int firstDirNo = gDirs.next(); const int lastDirNo = gDirs.last(); + initTest(); int dirCount = lastDirNo - firstDirNo + 1; SkAutoTDeleteArray<SkTDArray<TestResult> > tests(new SkTDArray<TestResult>[dirCount]); SkAutoTDeleteArray<SkTDArray<SortByName*> > sorted(new SkTDArray<SortByName*>[dirCount]); @@ -963,6 +973,7 @@ DEF_TEST(PathOpsSkpClipOneOff) { if (!skp) { skp = skipOver[testIndex].filename; } + initTest(); SkAssertResult(get_in_path(dirNo, skp).size()); SkString filename(skp); TestResult state; @@ -982,6 +993,7 @@ DEF_TEST(PathOpsTestSkipped) { } int dirNo = skip.directory; const char* skp = skip.filename; + initTest(); SkAssertResult(get_in_path(dirNo, skp).size()); SkString filename(skp); TestResult state; diff --git a/tests/RTConfRegistryTest.cpp b/tests/RTConfRegistryTest.cpp new file mode 100644 index 0000000000..be019f70b4 --- /dev/null +++ b/tests/RTConfRegistryTest.cpp @@ -0,0 +1,25 @@ +/* + * 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 "SkOSEnvironment.h" +#include "Test.h" + +// 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); +} + +DEF_TEST(SkRTConfRegistry, reporter) { + SkRTConfRegistry reg; + + sk_setenv("skia_nonexistent_item", "132"); + int result = 0; + test_rt_conf_parse(®, "nonexistent.item", &result); + REPORTER_ASSERT(reporter, result == 132); +} diff --git a/tests/RuntimeConfigTest.cpp b/tests/RuntimeConfigTest.cpp new file mode 100644 index 0000000000..b863ee1fd8 --- /dev/null +++ b/tests/RuntimeConfigTest.cpp @@ -0,0 +1,28 @@ +/* + * 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); +#ifdef SK_DEBUG + REPORTER_ASSERT(reporter, 2 == c_RTConfTestVariable); +#else // not SK_DEBUG + // Can not change RTConf variables in SK_RELEASE. + REPORTER_ASSERT(reporter, 1 == c_RTConfTestVariable); +#endif // SK_DEBUG + + // This should not give a warning. + SK_CONF_TRY_SET("test.utils.rtconf.nonexistentVariable", 7); +} diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index ccec37bf21..bf534f4820 100644 --- a/tests/SkpSkGrTest.cpp +++ b/tests/SkpSkGrTest.cpp @@ -18,6 +18,7 @@ #include "SkImageEncoder.h" #include "SkOSFile.h" #include "SkPicture.h" +#include "SkRTConf.h" #include "SkStream.h" #include "SkString.h" #include "SkTArray.h" |