diff options
Diffstat (limited to 'tests/scene/test_bit_map.h')
-rw-r--r-- | tests/scene/test_bit_map.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/scene/test_bit_map.h b/tests/scene/test_bit_map.h index 53afdc38f7..a102f40725 100644 --- a/tests/scene/test_bit_map.h +++ b/tests/scene/test_bit_map.h @@ -76,15 +76,11 @@ TEST_CASE("[BitMap] Create bit map from image alpha") { bit_map.create_from_image_alpha(empty_img); CHECK_MESSAGE(bit_map.get_size() == Size2i(256, 256), "Bitmap should have its old values because bitmap creation from an empty image should fail."); - Ref<Image> wrong_format_img; - wrong_format_img.instantiate(); - wrong_format_img->create(3, 3, false, Image::Format::FORMAT_DXT1); + Ref<Image> wrong_format_img = Image::create_empty(3, 3, false, Image::Format::FORMAT_DXT1); bit_map.create_from_image_alpha(wrong_format_img); CHECK_MESSAGE(bit_map.get_size() == Size2i(256, 256), "Bitmap should have its old values because converting from a compressed image should fail."); - Ref<Image> img; - img.instantiate(); - img->create(3, 3, false, Image::Format::FORMAT_RGBA8); + Ref<Image> img = Image::create_empty(3, 3, false, Image::Format::FORMAT_RGBA8); img->set_pixel(0, 0, Color(0, 0, 0, 0)); img->set_pixel(0, 1, Color(0, 0, 0, 0.09f)); img->set_pixel(0, 2, Color(0, 0, 0, 0.25f)); @@ -183,7 +179,7 @@ TEST_CASE("[BitMap] Get true bit count") { CHECK(bit_map.get_true_bit_count() == 0); bit_map.create(dim); - CHECK_MESSAGE(bit_map.get_true_bit_count() == 0, "Unitialized bit map should have no true bits"); + CHECK_MESSAGE(bit_map.get_true_bit_count() == 0, "Uninitialized bit map should have no true bits"); bit_map.set_bit_rect(Rect2i{ 0, 0, 256, 256 }, true); CHECK(bit_map.get_true_bit_count() == 65536); bit_map.set_bitv(Point2i{ 0, 0 }, false); @@ -196,7 +192,7 @@ TEST_CASE("[BitMap] Get size") { const Size2i dim{ 256, 256 }; BitMap bit_map{}; - CHECK_MESSAGE(bit_map.get_size() == Size2i(0, 0), "Unitialized bit map should have a size of 0x0"); + CHECK_MESSAGE(bit_map.get_size() == Size2i(0, 0), "Uninitialized bit map should have a size of 0x0"); bit_map.create(dim); CHECK(bit_map.get_size() == Size2i(256, 256)); @@ -390,7 +386,7 @@ TEST_CASE("[BitMap] Convert to image") { bit_map.create(dim); img = bit_map.convert_to_image(); CHECK_MESSAGE(img->get_size() == dim, "Image should have the same dimensions as the BitMap"); - CHECK_MESSAGE(img->get_pixel(0, 0).is_equal_approx(Color(0, 0, 0)), "BitMap is intialized to all 0's, so Image should be all black"); + CHECK_MESSAGE(img->get_pixel(0, 0).is_equal_approx(Color(0, 0, 0)), "BitMap is initialized to all 0's, so Image should be all black"); reset_bit_map(bit_map); bit_map.set_bit_rect(Rect2i(0, 0, 128, 128), true); |