summaryrefslogtreecommitdiffstats
path: root/tests/core
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2024-06-05 20:27:21 +0200
committerkobewi <kobewi4e@gmail.com>2024-06-05 20:31:42 +0200
commit5514b2c70c28a6133459075f85746fe05aaecc68 (patch)
tree7d9754f6f99ba1b59c998b8557f88eeb85250704 /tests/core
parent96a386f3c424af96d950ee5098b4b0e4907c9508 (diff)
downloadredot-engine-5514b2c70c28a6133459075f85746fe05aaecc68.tar.gz
Use subfolder for temporary test files
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/io/test_image.h4
-rw-r--r--tests/core/io/test_pck_packer.h8
-rw-r--r--tests/core/io/test_resource.h8
3 files changed, 10 insertions, 10 deletions
diff --git a/tests/core/io/test_image.h b/tests/core/io/test_image.h
index 7a0cbb13f9..1b51286a9f 100644
--- a/tests/core/io/test_image.h
+++ b/tests/core/io/test_image.h
@@ -78,8 +78,8 @@ TEST_CASE("[Image] Instantiation") {
TEST_CASE("[Image] Saving and loading") {
Ref<Image> image = memnew(Image(4, 4, false, Image::FORMAT_RGBA8));
- const String save_path_png = OS::get_singleton()->get_cache_path().path_join("image.png");
- const String save_path_exr = OS::get_singleton()->get_cache_path().path_join("image.exr");
+ const String save_path_png = TestUtils::get_temp_path("image.png");
+ const String save_path_exr = TestUtils::get_temp_path("image.exr");
// Save PNG
Error err;
diff --git a/tests/core/io/test_pck_packer.h b/tests/core/io/test_pck_packer.h
index fc4534a949..7ef9451963 100644
--- a/tests/core/io/test_pck_packer.h
+++ b/tests/core/io/test_pck_packer.h
@@ -42,7 +42,7 @@ namespace TestPCKPacker {
TEST_CASE("[PCKPacker] Pack an empty PCK file") {
PCKPacker pck_packer;
- const String output_pck_path = OS::get_singleton()->get_cache_path().path_join("output_empty.pck");
+ const String output_pck_path = TestUtils::get_temp_path("output_empty.pck");
CHECK_MESSAGE(
pck_packer.pck_start(output_pck_path) == OK,
"Starting a PCK file should return an OK error code.");
@@ -66,7 +66,7 @@ TEST_CASE("[PCKPacker] Pack an empty PCK file") {
TEST_CASE("[PCKPacker] Pack empty with zero alignment invalid") {
PCKPacker pck_packer;
- const String output_pck_path = OS::get_singleton()->get_cache_path().path_join("output_empty.pck");
+ const String output_pck_path = TestUtils::get_temp_path("output_empty.pck");
ERR_PRINT_OFF;
CHECK_MESSAGE(pck_packer.pck_start(output_pck_path, 0) != OK, "PCK with zero alignment should fail.");
ERR_PRINT_ON;
@@ -74,7 +74,7 @@ TEST_CASE("[PCKPacker] Pack empty with zero alignment invalid") {
TEST_CASE("[PCKPacker] Pack empty with invalid key") {
PCKPacker pck_packer;
- const String output_pck_path = OS::get_singleton()->get_cache_path().path_join("output_empty.pck");
+ const String output_pck_path = TestUtils::get_temp_path("output_empty.pck");
ERR_PRINT_OFF;
CHECK_MESSAGE(pck_packer.pck_start(output_pck_path, 32, "") != OK, "PCK with invalid key should fail.");
ERR_PRINT_ON;
@@ -82,7 +82,7 @@ TEST_CASE("[PCKPacker] Pack empty with invalid key") {
TEST_CASE("[PCKPacker] Pack a PCK file with some files and directories") {
PCKPacker pck_packer;
- const String output_pck_path = OS::get_singleton()->get_cache_path().path_join("output_with_files.pck");
+ const String output_pck_path = TestUtils::get_temp_path("output_with_files.pck");
CHECK_MESSAGE(
pck_packer.pck_start(output_pck_path) == OK,
"Starting a PCK file should return an OK error code.");
diff --git a/tests/core/io/test_resource.h b/tests/core/io/test_resource.h
index a83e7f88ba..cb1fa290b3 100644
--- a/tests/core/io/test_resource.h
+++ b/tests/core/io/test_resource.h
@@ -76,8 +76,8 @@ TEST_CASE("[Resource] Saving and loading") {
Ref<Resource> child_resource = memnew(Resource);
child_resource->set_name("I'm a child resource");
resource->set_meta("other_resource", child_resource);
- const String save_path_binary = OS::get_singleton()->get_cache_path().path_join("resource.res");
- const String save_path_text = OS::get_singleton()->get_cache_path().path_join("resource.tres");
+ const String save_path_binary = TestUtils::get_temp_path("resource.res");
+ const String save_path_text = TestUtils::get_temp_path("resource.tres");
ResourceSaver::save(resource, save_path_binary);
ResourceSaver::save(resource, save_path_text);
@@ -123,8 +123,8 @@ TEST_CASE("[Resource] Breaking circular references on save") {
resource_b->set_meta("next", resource_c);
resource_c->set_meta("next", resource_b);
- const String save_path_binary = OS::get_singleton()->get_cache_path().path_join("resource.res");
- const String save_path_text = OS::get_singleton()->get_cache_path().path_join("resource.tres");
+ const String save_path_binary = TestUtils::get_temp_path("resource.res");
+ const String save_path_text = TestUtils::get_temp_path("resource.tres");
ResourceSaver::save(resource_a, save_path_binary);
// Suppress expected errors caused by the resources above being uncached.
ERR_PRINT_OFF;