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

Unified Diff: tests/ValueTest.cpp

Issue 1613053006: SkValue: to/from SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@skvalue_xfermode2
Patch Set: 2016-01-21 (Thursday) 17:20:39 EST Created 4 years, 11 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/effects/SkToFromValue.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ValueTest.cpp
diff --git a/tests/ValueTest.cpp b/tests/ValueTest.cpp
index 0569a94bb4e1d59d679c40f03b9b213aeac0bba8..129ae42d86473de11305fed6fa53f1d3957d29b6 100644
--- a/tests/ValueTest.cpp
+++ b/tests/ValueTest.cpp
@@ -5,7 +5,9 @@
* found in the LICENSE file.
*/
+#include "Resources.h"
#include "SkData.h"
+#include "SkImage.h"
#include "SkMatrix.h"
#include "SkToFromValue.h"
#include "Test.h"
@@ -109,3 +111,21 @@ DEF_TEST(Value_Matrix, r) {
REPORTER_ASSERT(r, SkFromValue(val, &dst));
REPORTER_ASSERT(r, dst == m);
}
+
+DEF_TEST(Value_Image, r) {
+ SkAutoTUnref<SkImage> img1(GetResourceAsImage("mandrill_512.png"));
+ if (!img1) {
+ return;
+ }
+ auto val = SkToValue((const SkImage*)img1);
+ SkAutoTUnref<SkImage> img2;
+ REPORTER_ASSERT(r, SkFromValue(val, &img2));
+ if (!img2) {
+ return;
+ }
+ SkAutoTUnref<SkData> data1(img1->refEncoded());
+ SkAutoTUnref<SkData> data2(img2->refEncoded());
+ REPORTER_ASSERT(r, data1);
+ REPORTER_ASSERT(r, data2);
+ REPORTER_ASSERT(r, data1.get() == data2.get());
+}
« no previous file with comments | « src/effects/SkToFromValue.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698