Added test coverage to image buffer
This commit is contained in:
parent
86b65146a7
commit
f3abe7fc25
3 changed files with 21 additions and 6 deletions
|
@ -39,7 +39,10 @@ struct MAPNIK_DECL buffer
|
|||
~buffer();
|
||||
|
||||
buffer& operator=(buffer rhs);
|
||||
bool operator!() const;
|
||||
inline bool operator!() const
|
||||
{
|
||||
return (data_ == nullptr)? true : false;
|
||||
}
|
||||
|
||||
void swap(buffer & rhs);
|
||||
unsigned char* data();
|
||||
|
|
|
@ -71,11 +71,6 @@ void buffer::swap(buffer & rhs)
|
|||
std::swap(data_, rhs.data_);
|
||||
}
|
||||
|
||||
inline bool buffer::operator!() const
|
||||
{
|
||||
return (data_ == nullptr)? false : true;
|
||||
}
|
||||
|
||||
unsigned char* buffer::data()
|
||||
{
|
||||
return data_;
|
||||
|
|
|
@ -271,5 +271,22 @@ SECTION("test image_any initialization")
|
|||
|
||||
} // END SECTION
|
||||
|
||||
SECTION("Image Buffer")
|
||||
{
|
||||
mapnik::detail::buffer buf_zero(0);
|
||||
CHECK(buf_zero.size() == 0);
|
||||
CHECK(!buf_zero);
|
||||
mapnik::detail::buffer buf(10);
|
||||
CHECK(buf.size() == 10);
|
||||
CHECK_FALSE(!buf);
|
||||
unsigned char * d = buf.data();
|
||||
*d = 9;
|
||||
const mapnik::detail::buffer buf2 = buf;
|
||||
CHECK(buf2.size() == 10);
|
||||
unsigned char const* d2 = buf2.data();
|
||||
CHECK(*d2 == 9);
|
||||
|
||||
} // END SECTION
|
||||
|
||||
} // END TEST CASE
|
||||
|
||||
|
|
Loading…
Reference in a new issue