From c3638574267b0af5ca086b923e1c1777d1dd131d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 10 Feb 2019 14:54:16 +0100 Subject: [PATCH] Be explicit about usage of GDScript tests Also drop empty "image" test, and print proper error when passing wrong test name. Fixes #25638. --- main/tests/test_gdscript.cpp | 5 ++- main/tests/test_image.cpp | 69 ------------------------------------ main/tests/test_image.h | 45 ----------------------- main/tests/test_main.cpp | 8 +---- misc/dist/linux/godot.6 | 6 ++-- 5 files changed, 8 insertions(+), 125 deletions(-) delete mode 100644 main/tests/test_image.cpp delete mode 100644 main/tests/test_image.h diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 60f9568fbd..27ff2addf3 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -911,11 +911,14 @@ MainLoop *test(TestType p_type) { List cmdlargs = OS::get_singleton()->get_cmdline_args(); if (cmdlargs.empty()) { - //try editor! return NULL; } String test = cmdlargs.back()->get(); + if (!test.ends_with(".gd") && !test.ends_with(".gdc")) { + print_line("This test expects a path to a GDScript file as its last parameter. Got: " + test); + return NULL; + } FileAccess *fa = FileAccess::open(test, FileAccess::READ); diff --git a/main/tests/test_image.cpp b/main/tests/test_image.cpp deleted file mode 100644 index ee4f43bae0..0000000000 --- a/main/tests/test_image.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************/ -/* test_image.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "test_image.h" - -#include "core/io/image_loader.h" -#include "core/math/math_funcs.h" -#include "core/os/main_loop.h" -#include "core/print_string.h" - -namespace TestImage { - -class TestMainLoop : public MainLoop { - - bool quit; - -public: - virtual void input_event(const Ref &p_event) { - } - - virtual void init() { - - quit = false; - } - virtual bool iteration(float p_time) { - - return quit; - } - - virtual bool idle(float p_time) { - return quit; - } - - virtual void finish() { - } -}; - -MainLoop *test() { - - return memnew(TestMainLoop); -} -} // namespace TestImage diff --git a/main/tests/test_image.h b/main/tests/test_image.h deleted file mode 100644 index b9b3c0cb48..0000000000 --- a/main/tests/test_image.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************/ -/* test_image.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef TEST_IMAGE_H -#define TEST_IMAGE_H - -/** - @author Juan Linietsky -*/ - -#include "core/os/main_loop.h" - -namespace TestImage { - -MainLoop *test(); -} - -#endif diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp index 49f5cc5a18..22f1d7319f 100644 --- a/main/tests/test_main.cpp +++ b/main/tests/test_main.cpp @@ -36,7 +36,6 @@ #include "test_astar.h" #include "test_gdscript.h" #include "test_gui.h" -#include "test_image.h" #include "test_math.h" #include "test_oa_hash_map.h" #include "test_ordered_hash_map.h" @@ -61,7 +60,6 @@ const char **tests_get_names() { "gd_parser", "gd_compiler", "gd_bytecode", - "image", "ordered_hash_map", "astar", NULL @@ -134,11 +132,6 @@ MainLoop *test_main(String p_test, const List &p_args) { return TestGDScript::test(TestGDScript::TEST_BYTECODE); } - if (p_test == "image") { - - return TestImage::test(); - } - if (p_test == "ordered_hash_map") { return TestOrderedHashMap::test(); @@ -149,6 +142,7 @@ MainLoop *test_main(String p_test, const List &p_args) { return TestAStar::test(); } + print_line("Unknown test: " + p_test); return NULL; } diff --git a/misc/dist/linux/godot.6 b/misc/dist/linux/godot.6 index e6fd1b9991..078f8bcf91 100644 --- a/misc/dist/linux/godot.6 +++ b/misc/dist/linux/godot.6 @@ -56,7 +56,7 @@ Remote filesystem ([:] address). Password for remote filesystem. .TP \fB\-\-audio\-driver\fR -Audio driver ('PulseAudio', 'ALSA'). +Audio driver ('PulseAudio', 'ALSA', 'Dummy'). .TP \fB\-\-video\-driver\fR Video driver ('GLES3', 'GLES2'). @@ -133,7 +133,7 @@ Only parse for errors and quit (use with --script). \fB\-\-export\fR Export the project using the given export target. Export only main pack if path ends with .pck or .zip. .TP -\fB\-\-export\-debug\fR +\fB\-\-export\-debug\fR Like \-\-export, but use debug template. .TP \fB\-\-doctool\fR @@ -149,7 +149,7 @@ Build the scripting solutions (e.g. for C# projects). Generate JSON dump of the Godot API for GDNative bindings. .TP \fB\-\-test\fR -Run a unit test ('string', 'math', 'physics', 'physics_2d', 'render', 'oa_hash_map', 'gui', 'shaderlang', 'gd_tokenizer', 'gd_parser', 'gd_compiler', 'gd_bytecode', 'image', 'ordered_hash_map'). +Run a unit test ('string', 'math', 'physics', 'physics_2d', 'render', 'oa_hash_map', 'gui', 'shaderlang', 'gd_tokenizer', 'gd_parser', 'gd_compiler', 'gd_bytecode', 'ordered_hash_map', 'astar'). .SH FILES XDG_DATA_CONFIG/godot/ or ~/.config/godot/ .RS