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

Unified Diff: tests/StreamTest.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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 | « tests/PictureTest.cpp ('k') | tests/TypefaceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/StreamTest.cpp
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index 56977822b9db5cb9621c672aab20766c7fd67cd5..74e60557d1cb83603527081f95326199ade2e5f0 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -117,13 +117,13 @@ static void TestWStream(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, ds.getOffset() == 100 * 26);
{
- sk_sp<SkData> data(ds.copyToData());
+ sk_sp<SkData> data = ds.snapshotAsData();
REPORTER_ASSERT(reporter, 100 * 26 == data->size());
REPORTER_ASSERT(reporter, memcmp(dst, data->data(), data->size()) == 0);
}
{
- // Test that this works after a copyToData.
+ // Test that this works after a snapshot.
SkAutoTDelete<SkStreamAsset> stream(ds.detachAsStream());
REPORTER_ASSERT(reporter, ds.getOffset() == 0);
test_loop_stream(reporter, stream.get(), s, 26, 100);
@@ -174,15 +174,14 @@ static void TestPackedUInt(skiatest::Reporter* reporter) {
static void TestDereferencingData(SkMemoryStream* memStream) {
memStream->read(nullptr, 0);
memStream->getMemoryBase();
- sk_sp<SkData> data(memStream->copyToData());
+ (void)memStream->asData();
}
static void TestNullData() {
- SkData* nullData = nullptr;
- SkMemoryStream memStream(nullData);
+ SkMemoryStream memStream(nullptr);
TestDereferencingData(&memStream);
- memStream.setData(nullData);
+ memStream.setData(nullptr);
TestDereferencingData(&memStream);
}
@@ -404,8 +403,7 @@ static void stream_copy_test(skiatest::Reporter* reporter,
ERRORF(reporter, "SkStreamCopy failed");
return;
}
- sk_sp<SkData> data(tgt.copyToData());
- tgt.reset();
+ sk_sp<SkData> data(tgt.detachAsData());
if (data->size() != N) {
ERRORF(reporter, "SkStreamCopy incorrect size");
return;
« no previous file with comments | « tests/PictureTest.cpp ('k') | tests/TypefaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698