diff options
author | djsollen <djsollen@google.com> | 2014-08-14 06:29:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-14 06:29:03 -0700 |
commit | 3b6255493e458c6b2c1412af908581f0bf3f6b70 (patch) | |
tree | a58d075a0e1fb6a5870460ff79c5be2239e5d7f6 /tests | |
parent | 30e26cdb411ef55f7ce3d53015546250443f27f8 (diff) |
Remove SkPaintOptionsAndroid
Committed: https://skia.googlesource.com/skia/+/f32331ffdb5de0440bb337aa7cbdd6f33e9ff23b
R=reed@google.com, mtklein@google.com, tomhudson@google.com
Author: djsollen@google.com
Review URL: https://codereview.chromium.org/447873003
Diffstat (limited to 'tests')
-rw-r--r-- | tests/AndroidPaintTest.cpp | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/tests/AndroidPaintTest.cpp b/tests/AndroidPaintTest.cpp deleted file mode 100644 index f5cf84f4f3..0000000000 --- a/tests/AndroidPaintTest.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// SkPaints only have an SkPaintOptionsAndroid if SK_BUILD_FOR_ANDROID is true. -#ifdef SK_BUILD_FOR_ANDROID - -#include "SkReadBuffer.h" -#include "SkWriteBuffer.h" -#include "SkPaint.h" -#include "SkPaintOptionsAndroid.h" -#include "Test.h" - -static size_t Reconstruct(const SkPaint& src, SkPaint* dst) { - SkWriteBuffer writer; - src.flatten(writer); - - const size_t size = writer.bytesWritten(); - SkAutoMalloc bytes(size); - writer.writeToMemory(bytes.get()); - - SkReadBuffer reader(bytes.get(), size); - dst->unflatten(reader); - - return size; -} - -DEF_TEST(AndroidOptionsSerialization, reporter) { - // We want to make sure that Android's paint options survive a flatten/unflatten round trip. - // These are all non-default options. - SkPaintOptionsAndroid options; - options.setLanguage("ja-JP"); - options.setFontVariant(SkPaintOptionsAndroid::kElegant_Variant); - - SkPaint paint; - paint.setPaintOptionsAndroid(options); - - SkPaint reconstructed; - Reconstruct(paint, &reconstructed); - - REPORTER_ASSERT(reporter, options == reconstructed.getPaintOptionsAndroid()); -} - -DEF_TEST(AndroidOptionsSerializationReverse, reporter) { - // Opposite test of above: make sure the serialized default values of a paint overwrite - // non-default values on the paint we're unflattening into. - const SkPaint defaultOptions; - - SkPaintOptionsAndroid options; - options.setLanguage("ja-JP"); - options.setFontVariant(SkPaintOptionsAndroid::kElegant_Variant); - SkPaint nonDefaultOptions; - nonDefaultOptions.setPaintOptionsAndroid(options); - - Reconstruct(defaultOptions, &nonDefaultOptions); - - REPORTER_ASSERT(reporter, - defaultOptions.getPaintOptionsAndroid() == - nonDefaultOptions.getPaintOptionsAndroid()); -} - -DEF_TEST(AndroidOptionsSize, reporter) { - // A paint with default android options should serialize to something smaller than - // a paint with non-default android options. - - SkPaint defaultOptions; - - SkPaintOptionsAndroid options; - options.setLanguage("ja-JP"); - SkPaint nonDefaultOptions; - nonDefaultOptions.setPaintOptionsAndroid(options); - - SkPaint dummy; - - REPORTER_ASSERT(reporter, - Reconstruct(defaultOptions, &dummy) < Reconstruct(nonDefaultOptions, &dummy)); -} - -#endif // SK_BUILD_FOR_ANDROID |