Be explicit about usage of GDScript tests
Also drop empty "image" test, and print proper error when passing wrong test name. Fixes #25638.
This commit is contained in:
parent
f614f15506
commit
c363857426
5 changed files with 8 additions and 125 deletions
|
@ -911,11 +911,14 @@ MainLoop *test(TestType p_type) {
|
|||
List<String> 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);
|
||||
|
||||
|
|
|
@ -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<InputEvent> &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
|
|
@ -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 <reduzio@gmail.com>
|
||||
*/
|
||||
|
||||
#include "core/os/main_loop.h"
|
||||
|
||||
namespace TestImage {
|
||||
|
||||
MainLoop *test();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -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<String> &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<String> &p_args) {
|
|||
return TestAStar::test();
|
||||
}
|
||||
|
||||
print_line("Unknown test: " + p_test);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
6
misc/dist/linux/godot.6
vendored
6
misc/dist/linux/godot.6
vendored
|
@ -56,7 +56,7 @@ Remote filesystem (<host/IP>[:<port>] address).
|
|||
Password for remote filesystem.
|
||||
.TP
|
||||
\fB\-\-audio\-driver\fR <driver>
|
||||
Audio driver ('PulseAudio', 'ALSA').
|
||||
Audio driver ('PulseAudio', 'ALSA', 'Dummy').
|
||||
.TP
|
||||
\fB\-\-video\-driver\fR <driver>
|
||||
Video driver ('GLES3', 'GLES2').
|
||||
|
@ -133,7 +133,7 @@ Only parse for errors and quit (use with --script).
|
|||
\fB\-\-export\fR <target>
|
||||
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 <target>
|
||||
Like \-\-export, but use debug template.
|
||||
.TP
|
||||
\fB\-\-doctool\fR <path>
|
||||
|
@ -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 <test>
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue