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

Unified Diff: tests/DataRefTest.cpp

Issue 1574603002: Make SkROBuffer::Iter::size() work when exhausted (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/core/SkRWBuffer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DataRefTest.cpp
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index 0c7d5f452023d0e42e4fc857220feb3fe00b362f..f1e645ec7e7cbac855b5bc9de44ca664384cdec4 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -313,3 +313,18 @@ DEF_TEST(RWBuffer, reporter) {
delete streams[i];
}
}
+
+// Tests that it is safe to call SkROBuffer::Iter::size() when exhausted.
+DEF_TEST(RWBuffer_size, r) {
+ SkRWBuffer buffer;
+ buffer.append(gABC, 26);
+
+ SkAutoTUnref<SkROBuffer> roBuffer(buffer.newRBufferSnapshot());
+ SkROBuffer::Iter iter(roBuffer);
+ REPORTER_ASSERT(r, iter.data());
+ REPORTER_ASSERT(r, iter.size() == 26);
+
+ // There is only one block in this buffer.
+ REPORTER_ASSERT(r, !iter.next());
+ REPORTER_ASSERT(r, 0 == iter.size());
+}
« no previous file with comments | « src/core/SkRWBuffer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698