aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PaintTest.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 13:08:17 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 13:08:17 +0000
commitac5004682fde163b09e5ee394cec1732c4d94541 (patch)
treeb0733055d92f6b757b5be2aeae6ab321c05a1eae /tests/PaintTest.cpp
parentc05d2859e10f4e1fb0c6486eebfbe88801202648 (diff)
Reverting r13496 (Merge tomhudson and mtklein SkPaint shrinking approaches) due to memory leaks
git-svn-id: http://skia.googlecode.com/svn/trunk@13509 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PaintTest.cpp')
-rw-r--r--tests/PaintTest.cpp40
1 files changed, 0 insertions, 40 deletions
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 216c2ea9a3..3210e77f19 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -11,11 +11,8 @@
#include "SkPaint.h"
#include "SkPath.h"
#include "SkRandom.h"
-#include "SkReadBuffer.h"
#include "SkTypeface.h"
#include "SkUtils.h"
-#include "SkWriteBuffer.h"
-#include "SkXfermode.h"
#include "Test.h"
static size_t uni_to_utf8(const SkUnichar src[], void* dst, int count) {
@@ -254,40 +251,3 @@ DEF_TEST(Paint, reporter) {
test_cmap(reporter);
}
}
-
-#define ASSERT(expr) REPORTER_ASSERT(r, expr)
-
-DEF_TEST(Paint_FlatteningTraits, r) {
- SkPaint paint;
- paint.setColor(0x00AABBCC);
- paint.setTextScaleX(1.0f); // Encoded despite being the default value.
- paint.setTextSize(19);
- paint.setXfermode(SkXfermode::Create(SkXfermode::kModulate_Mode));
- paint.setLooper(NULL); // Ignored.
-
- SkWriteBuffer writer;
- SkPaint::FlatteningTraits::Flatten(writer, paint);
- const size_t expectedBytesWritten = sizeof(void*) == 8 ? 48 : 40;
- ASSERT(expectedBytesWritten == writer.bytesWritten());
-
- const uint32_t* written = writer.getWriter32()->contiguousArray();
- SkASSERT(written != NULL);
- ASSERT(*written == ((1<<0) | (1<<2) | (1<<3) | (1<<9))); // Dirty bits for our 4.
-
- SkReadBuffer reader(written, writer.bytesWritten());
- SkPaint other;
- SkPaint::FlatteningTraits::Unflatten(reader, &other);
- ASSERT(reader.offset() == writer.bytesWritten());
-
- // No matter the encoding, these must always hold.
- ASSERT(other.getColor() == paint.getColor());
- ASSERT(other.getTextScaleX() == paint.getTextScaleX());
- ASSERT(other.getTextSize() == paint.getTextSize());
- ASSERT(other.getLooper() == paint.getLooper());
-
- // We have to be a little looser and compare just the modes. Pointers might not be the same.
- SkXfermode::Mode otherMode, paintMode;
- ASSERT(other.getXfermode()->asMode(&otherMode));
- ASSERT(paint.getXfermode()->asMode(&paintMode));
- ASSERT(otherMode == paintMode);
-}