aboutsummaryrefslogtreecommitdiff
path: root/tests/PathTest.cpp
diff options
context:
space:
mode:
authormtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-07 19:17:53 +0000
committermtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-07 19:17:53 +0000
commit9c9d4a70028ef8dc33a46cfc0b22e254443effe3 (patch)
tree0c0eceba058ae5f7ec60ab0e70f058b05a5f7dbb /tests/PathTest.cpp
parent8dc8bc55479eb7895b3f0cf4fb42d9d917b21ee1 (diff)
Restore SkPath(const SkPath&) to copy the generation ID on Android.
BUG= R=bsalomon@google.com, bungeman@google.com, reed@google.com Review URL: https://codereview.chromium.org/22471002 git-svn-id: http://skia.googlecode.com/svn/trunk@10622 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathTest.cpp')
-rw-r--r--tests/PathTest.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index e33c912062..e698c7cda5 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -15,8 +15,9 @@
#include "SkRandom.h"
#include "SkReader32.h"
#include "SkSize.h"
-#include "SkWriter32.h"
#include "SkSurface.h"
+#include "SkTypes.h"
+#include "SkWriter32.h"
#if defined(WIN32)
#define SUPPRESS_VISIBILITY_WARNING
@@ -31,6 +32,23 @@ static SkSurface* new_surface(int w, int h) {
return SkSurface::NewRaster(info);
}
+static void test_android_specific_behavior(skiatest::Reporter* reporter) {
+#ifdef SK_BUILD_FOR_ANDROID
+ // Copy constructor should preserve generation ID, but assignment shouldn't.
+ SkPath original;
+ original.moveTo(0, 0);
+ original.lineTo(1, 1);
+ REPORTER_ASSERT(reporter, original.getGenerationID() > 0);
+
+ const SkPath copy(original);
+ REPORTER_ASSERT(reporter, copy.getGenerationID() == original.getGenerationID());
+
+ SkPath assign;
+ assign = original;
+ REPORTER_ASSERT(reporter, assign.getGenerationID() != original.getGenerationID());
+#endif
+}
+
// This used to assert in the debug build, as the edges did not all line-up.
static void test_bad_cubic_crbug234190() {
SkPath path;
@@ -2450,6 +2468,7 @@ static void TestPath(skiatest::Reporter* reporter) {
test_crbug_170666();
test_bad_cubic_crbug229478();
test_bad_cubic_crbug234190();
+ test_android_specific_behavior(reporter);
}
#include "TestClassDef.h"