diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-07 15:22:05 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-07 15:22:05 +0000 |
commit | 37ffe8a5a38606b2099f6a93e82bf121cab92cc7 (patch) | |
tree | 678304cadf0ed98b891457708b3cac459ba602b3 /tests/PaintTest.cpp | |
parent | a4eb459fd1aeeef338d804a474d198318ac6b722 (diff) |
Remove operator== from SkPaint
R=mtklein@google.com, reed@google.com
Author: sglez@google.com
Review URL: https://chromiumcodereview.appspot.com/21949007
git-svn-id: http://skia.googlecode.com/svn/trunk@10603 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PaintTest.cpp')
-rw-r--r-- | tests/PaintTest.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index e25c7c3f08..d71d12fc74 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -133,6 +133,15 @@ static void test_filterlevel(skiatest::Reporter* reporter) { } } +// Only useful for test_copy. Checks the fields that are set. +static bool check_equal(const SkPaint& a, const SkPaint &b) { + return a.getLooper() == b.getLooper() && + a.getMaskFilter() == b.getMaskFilter() && + a.getStrokeWidth() == b.getStrokeWidth() && + a.getStyle() == b.getStyle() && + a.getTextAlign() == b.getTextAlign(); +} + static void test_copy(skiatest::Reporter* reporter) { SkPaint paint; // set a few member variables @@ -147,19 +156,19 @@ static void test_copy(skiatest::Reporter* reporter) { // copy the paint using the copy constructor and check they are the same SkPaint copiedPaint = paint; - REPORTER_ASSERT(reporter, paint == copiedPaint); + REPORTER_ASSERT(reporter, check_equal(paint, copiedPaint)); #ifdef SK_BUILD_FOR_ANDROID // the copy constructor should preserve the Generation ID uint32_t paintGenID = paint.getGenerationID(); uint32_t copiedPaintGenID = copiedPaint.getGenerationID(); REPORTER_ASSERT(reporter, paintGenID == copiedPaintGenID); - REPORTER_ASSERT(reporter, !memcmp(&paint, &copiedPaint, sizeof(paint))); + REPORTER_ASSERT(reporter, check_equal(paint, copiedPaint)); #endif // copy the paint using the equal operator and check they are the same copiedPaint = paint; - REPORTER_ASSERT(reporter, paint == copiedPaint); + REPORTER_ASSERT(reporter, check_equal(paint, copiedPaint)); #ifdef SK_BUILD_FOR_ANDROID // the equals operator should increment the Generation ID @@ -173,8 +182,8 @@ static void test_copy(skiatest::Reporter* reporter) { SkPaint cleanPaint; paint.reset(); copiedPaint.reset(); - REPORTER_ASSERT(reporter, cleanPaint == paint); - REPORTER_ASSERT(reporter, cleanPaint == copiedPaint); + REPORTER_ASSERT(reporter, check_equal(cleanPaint, paint)); + REPORTER_ASSERT(reporter, check_equal(cleanPaint, copiedPaint)); #ifdef SK_BUILD_FOR_ANDROID // the reset function should increment the Generation ID |