Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Unified Diff: tests/PathTest.cpp

Issue 22471002: Restore SkPath(const SkPath&) to copy the generation ID on Android. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix asserts Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathTest.cpp
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index e33c912062228589f95e585aaa3b64771c89206b..e698c7cda5fe4c777e1cbb75a064e398d64c8783 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"
« no previous file with comments | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698