summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-05-25 15:19:10 +0200
committerGitHub <noreply@github.com>2021-05-25 15:19:10 +0200
commitf164c00a94793234879dc1824bd657db6df939ec (patch)
tree2e6c19a493c20e356b01a2a79f10e63c6e75ff56 /tests
parent313e1f62bb4ed85041bcd9290ec76660878fcd6b (diff)
parentda5d7db6100955922e08ee99a02f827214ed8281 (diff)
Merge pull request #49061 from madmiraal/rename-len-length
Rename File::get_len() get_length()
Diffstat (limited to 'tests')
-rw-r--r--tests/test_image.h20
-rw-r--r--tests/test_math.cpp4
-rw-r--r--tests/test_pck_packer.h8
3 files changed, 16 insertions, 16 deletions
diff --git a/tests/test_image.h b/tests/test_image.h
index d73717f5b7..99c2a9380d 100644
--- a/tests/test_image.h
+++ b/tests/test_image.h
@@ -101,8 +101,8 @@ TEST_CASE("[Image] Saving and loading") {
Ref<Image> image_bmp = memnew(Image());
FileAccessRef f_bmp = FileAccess::open(TestUtils::get_data_path("images/icon.bmp"), FileAccess::READ, &err);
PackedByteArray data_bmp;
- data_bmp.resize(f_bmp->get_len() + 1);
- f_bmp->get_buffer(data_bmp.ptrw(), f_bmp->get_len());
+ data_bmp.resize(f_bmp->get_length() + 1);
+ f_bmp->get_buffer(data_bmp.ptrw(), f_bmp->get_length());
CHECK_MESSAGE(
image_bmp->load_bmp_from_buffer(data_bmp) == OK,
"The BMP image should load successfully.");
@@ -111,8 +111,8 @@ TEST_CASE("[Image] Saving and loading") {
Ref<Image> image_jpg = memnew(Image());
FileAccessRef f_jpg = FileAccess::open(TestUtils::get_data_path("images/icon.jpg"), FileAccess::READ, &err);
PackedByteArray data_jpg;
- data_jpg.resize(f_jpg->get_len() + 1);
- f_jpg->get_buffer(data_jpg.ptrw(), f_jpg->get_len());
+ data_jpg.resize(f_jpg->get_length() + 1);
+ f_jpg->get_buffer(data_jpg.ptrw(), f_jpg->get_length());
CHECK_MESSAGE(
image_jpg->load_jpg_from_buffer(data_jpg) == OK,
"The JPG image should load successfully.");
@@ -121,8 +121,8 @@ TEST_CASE("[Image] Saving and loading") {
Ref<Image> image_webp = memnew(Image());
FileAccessRef f_webp = FileAccess::open(TestUtils::get_data_path("images/icon.webp"), FileAccess::READ, &err);
PackedByteArray data_webp;
- data_webp.resize(f_webp->get_len() + 1);
- f_webp->get_buffer(data_webp.ptrw(), f_webp->get_len());
+ data_webp.resize(f_webp->get_length() + 1);
+ f_webp->get_buffer(data_webp.ptrw(), f_webp->get_length());
CHECK_MESSAGE(
image_webp->load_webp_from_buffer(data_webp) == OK,
"The WEBP image should load successfully.");
@@ -131,8 +131,8 @@ TEST_CASE("[Image] Saving and loading") {
Ref<Image> image_png = memnew(Image());
FileAccessRef f_png = FileAccess::open(TestUtils::get_data_path("images/icon.png"), FileAccess::READ, &err);
PackedByteArray data_png;
- data_png.resize(f_png->get_len() + 1);
- f_png->get_buffer(data_png.ptrw(), f_png->get_len());
+ data_png.resize(f_png->get_length() + 1);
+ f_png->get_buffer(data_png.ptrw(), f_png->get_length());
CHECK_MESSAGE(
image_png->load_png_from_buffer(data_png) == OK,
"The PNG image should load successfully.");
@@ -141,8 +141,8 @@ TEST_CASE("[Image] Saving and loading") {
Ref<Image> image_tga = memnew(Image());
FileAccessRef f_tga = FileAccess::open(TestUtils::get_data_path("images/icon.tga"), FileAccess::READ, &err);
PackedByteArray data_tga;
- data_tga.resize(f_tga->get_len() + 1);
- f_tga->get_buffer(data_tga.ptrw(), f_tga->get_len());
+ data_tga.resize(f_tga->get_length() + 1);
+ f_tga->get_buffer(data_tga.ptrw(), f_tga->get_length());
CHECK_MESSAGE(
image_tga->load_tga_from_buffer(data_tga) == OK,
"The TGA image should load successfully.");
diff --git a/tests/test_math.cpp b/tests/test_math.cpp
index 85cfdf7d2c..88c32713ed 100644
--- a/tests/test_math.cpp
+++ b/tests/test_math.cpp
@@ -529,8 +529,8 @@ MainLoop *test() {
ERR_FAIL_COND_V_MSG(!fa, nullptr, "Could not open file: " + test);
Vector<uint8_t> buf;
- uint64_t flen = fa->get_len();
- buf.resize(fa->get_len() + 1);
+ uint64_t flen = fa->get_length();
+ buf.resize(fa->get_length() + 1);
fa->get_buffer(buf.ptrw(), flen);
buf.write[flen] = 0;
diff --git a/tests/test_pck_packer.h b/tests/test_pck_packer.h
index 8e4721b821..06e4e64963 100644
--- a/tests/test_pck_packer.h
+++ b/tests/test_pck_packer.h
@@ -62,10 +62,10 @@ TEST_CASE("[PCKPacker] Pack an empty PCK file") {
err == OK,
"The generated empty PCK file should be opened successfully.");
CHECK_MESSAGE(
- f->get_len() >= 100,
+ f->get_length() >= 100,
"The generated empty PCK file shouldn't be too small (it should have the PCK header).");
CHECK_MESSAGE(
- f->get_len() <= 500,
+ f->get_length() <= 500,
"The generated empty PCK file shouldn't be too large.");
}
@@ -103,10 +103,10 @@ TEST_CASE("[PCKPacker] Pack a PCK file with some files and directories") {
err == OK,
"The generated non-empty PCK file should be opened successfully.");
CHECK_MESSAGE(
- f->get_len() >= 25000,
+ f->get_length() >= 25000,
"The generated non-empty PCK file should be large enough to actually hold the contents specified above.");
CHECK_MESSAGE(
- f->get_len() <= 35000,
+ f->get_length() <= 35000,
"The generated non-empty PCK file shouldn't be too large.");
}
} // namespace TestPCKPacker