Fix SkSpan supspan() add test
Change-Id: Ida683aa054fef977b91b3232b063f74344ffc2c9 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289448 Auto-Submit: Herb Derby <herb@google.com> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
0c228e3f64
commit
537dc05d41
@ -52,7 +52,7 @@ public:
|
||||
}
|
||||
constexpr SkSpan<T> subspan(size_t offset, size_t count) const {
|
||||
SkASSERT(offset <= this->size());
|
||||
SkASSERT(count <= this->size - offset);
|
||||
SkASSERT(count <= this->size() - offset);
|
||||
if (count == 0) { return SkSpan{}; }
|
||||
return SkSpan{fPtr + offset, count};
|
||||
}
|
||||
|
@ -202,6 +202,10 @@ DEF_TEST(SkMakeSpan, reporter) {
|
||||
REPORTER_ASSERT(reporter, s[3] == 4);
|
||||
s[3] = 100;
|
||||
REPORTER_ASSERT(reporter, s[3] == 100);
|
||||
auto s1 = s.subspan(1,3);
|
||||
REPORTER_ASSERT(reporter, s1.size() == 3);
|
||||
REPORTER_ASSERT(reporter, s1.front() == 2);
|
||||
REPORTER_ASSERT(reporter, s1.back() == 100);
|
||||
}
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user