Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ImageGetPixelTest(){
- auto side = Tile::SIZE;
- Size size{side * 2 + 3, side * 2 + 5};
- const char color = 'g';
- const Image img(size, color);
- for (auto x = 0; x < size.width; ++x){
- for (auto y = 0; y < size.height; ++y){
- PRACTIKUM_ASSERT_EQUAL(img.GetPixel({x, y}), color);
- }
- }
- char blank = ' ';
- ASSERT_EQUAL(img.GetPixel({-1, 2}), blank);
- ASSERT_EQUAL(img.GetPixel({1, -2}), blank);
- ASSERT_EQUAL(img.GetPixel({side*5, 2}), blank);
- ASSERT_EQUAL(img.GetPixel({2, side*5}), blank);
- }
- void ImageSetPixelTest(){
- auto side = Tile::SIZE;
- const Size size{side * 2 + 3, side * 2 + 5};
- const char color = 'g';
- Image img(size, color);
- char new_color = 'n';
- for (auto x = 0; x < size.width; ++x){
- for (auto y = 0; y < size.height; ++y){
- img.SetPixel({x, y}, new_color);
- ASSERT_EQUAL(img.GetPixel({x, y}), new_color);
- }
- }
- img.SetPixel({-1, 3}, new_color);
- img.SetPixel({1, -3}, new_color);
- img.SetPixel({-1, -3}, new_color);
- img.SetPixel({size.width, size.height + 2}, new_color);
- img.SetPixel({size.width + 2, size.height}, new_color);
- img.SetPixel({size.width + 2, size.height + 2}, new_color);
- Print(img, cout);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement