Commit graph

691 commits

Author SHA1 Message Date
Rémi Verschelde
9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
reduz
f2397809a8 Refactored Variant Operators.
-Using classes to call and a table
-For typed code (GDS or GDNative), can obtain functions to call prevalidated or ptr.
2020-11-06 12:45:50 -03:00
Hugo Locurcio
7adb6b91b3
Remove Color.contrasted() as its behavior is barely useful
Returning the most contrasting color isn't a trivial task, as there
are often many possible choices. It's usually best left for the user
to implement using a script.
2020-11-03 04:46:08 -05:00
reduz
ee06a70ea6 Refactor MethodBind to use variadic templates
Removed make_binders and the old style generated binders.
2020-10-18 12:28:44 +02:00
Lyuma
48e8da4aac core/command_queue_mt: Customizable size and tests
Adds unit tests for command_queue_mt.h/cpp
In this revision, some unit tests will fail due to issue #42107.
2020-10-12 08:24:08 -07:00
Andrii Doroshenko (Xrayez)
dbce08d4ba Add test cases for the List to cover public methods
Except for overloaded operators.
2020-09-23 14:03:13 +03:00
Rémi Verschelde
3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 13:44:25 +02:00
Rémi Verschelde
6ac7b90097
Merge pull request #42013 from Xrayez/fix-list-swap
Fix `List` swap behavior on front, back and adjacent elements
2020-09-16 17:39:43 +02:00
Pawel Lampe
b2d8c5140e Add test cases for numeric literals with underscores 2020-09-14 20:21:07 +02:00
Andrii Doroshenko (Xrayez)
4e6b5169b0 Add a test suite for List
Adds a number of test cases for `List::swap()`.
2020-09-13 00:14:51 +03:00
Andrii Doroshenko (Xrayez)
174b6e817f Move GDNative String tests to respective module
GDNative-specific tests moved out of main `tests/` folder into
`modules/gdnative/tests`.

Include path for GDNative headers are still hardcoded in `tests/SCsub`,
but made conditional now.

Also fixed test case tag typos.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2020-09-11 14:51:38 +03:00
bruvzg
80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
strank
16913368eb Fix doctest runner ignoring all arguments starting with --test
Instead of just the one argument that is exactly --test.
The long-form arguments --test-case and --test-suite were ignored.
2020-09-02 11:23:34 -04:00
Andrii Doroshenko (Xrayez)
0cc05c5a31 Register GDScript test tools as test commands to run via command-line 2020-09-02 01:43:26 +03:00
Andrii Doroshenko (Xrayez)
6b7e50ab34 Move GDScript tests to respective folder under modules 2020-09-02 01:09:32 +03:00
George Marques
635c6a0a18
Add GDScript disassembler 2020-09-01 14:36:30 -03:00
Aaron Franke
1a5ba0fc07
Fix Color test cases for RGBA 2020-09-01 02:07:35 -04:00
Rémi Verschelde
a276e6fc36
Merge pull request #40955 from Calinou/test-add-expression
Add a test suite for Expression
2020-08-31 11:12:34 +02:00
Hugo Locurcio
d5ffa42cd2
Add a test suite for Expression
This also makes the first parameter of `Expression::execute()` optional
from C++. Previously, it was only optional in the scripting API.
2020-08-27 15:16:09 +02:00
Hugo Locurcio
66de28ada5
Add a test suite for Gradient 2020-08-19 01:33:40 +02:00
Andrii Doroshenko (Xrayez)
6f426c3360 Port ClassDB tests to use doctest
Extracted the most minimal core initialization functionality from
`setup()` and `setup2()` so that `ClassDB` could be tested properly
(input, audio, rendering, physics etc, are excluded).

Display and rendering servers/singletons are not initialized at all.

Due to the fact that most subsystems are disabled, fixed various crashes in the
process (in order):
- `AcceptDialog` OK/cancel swap behavior (used `DisplayServer` while
  `register_scene_types()`);
- `make_default_theme` which depends on `RenderingServer`;
- `XRServer` singleton access while calling `register_modules_types()`;
- hidden bug in a way joypads are cleaned up (MacOS and Linux only).

Removed manual `ClassDB` init/cleanup calls from `test_validate_testing.h`.

ClassDB tests:

Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
2020-08-16 16:41:02 +03:00
Rémi Verschelde
c9dbe14a8f
Merge pull request #41117 from 3akev/master
Port OrderedHashMap tests to doctest
2020-08-14 13:08:57 +02:00
Rémi Verschelde
b3707aeff2
Merge pull request #40940 from fire/tests-port-basis
Port Basis tests to use doctest.
2020-08-11 12:43:52 +02:00
Aladdin Al-Khafaji
9118a41dea Port OrderedHashMap tests to doctest 2020-08-08 15:49:50 +03:00
Andrii Doroshenko (Xrayez)
76e00d2405 Stringify Variant compatible types for doctest output 2020-08-02 01:38:24 +03:00
K. S. Ernest (iFire) Lee
98b709c3f8 Port Basis tests to use doctest. 2020-08-01 08:27:10 -07:00
Andrii Doroshenko (Xrayez)
db1259ac70 Fix memory leak in test args 2020-07-31 23:58:22 +03:00
Rémi Verschelde
29df1919e1
Merge pull request #40928 from bruvzg/fix_test_heap_use_after_free
Fix heap use after free in the doctest "main".
2020-07-31 21:21:18 +02:00
Hugo Locurcio
979072b9a4
Add a test suite for Color 2020-07-31 21:04:16 +02:00
bruvzg
0a89498f51
Fix heap use after free in the doctest "main". 2020-07-31 21:52:48 +03:00
Andrii Doroshenko (Xrayez)
3645317036 Port AStar tests to use doctest 2020-07-31 02:09:40 +03:00
Andrii Doroshenko (Xrayez)
0512cc01d9 Hide implementation details of doctest macros
`test_macros.h` is created to provide various macros acting as aliases for
doctest macros to work better with Godot internals and conventions. This also
makes it accessible for those who'd like to start writing tests in Godot, as
most vital information can be put together and documented directly in
`test_macros.h` header.

Developers are encouraged to include the new `tests/test_macros.h` for writing
new tests over `thirdparty/doctest/doctest.h`.

Added `TEST_CASE_PENDING("name")` as an alias for
`TEST_CASE("name", doctest::skip())` which could be used to mark failing tests
for issues yet to be fixed, so as to not affect CI testing results.

Added `ERR_PRINT_OFF` and `ERR_PRINT_ON` to control error printing for testing
various **expected** failure paths within Godot without polluting the test
summary with error messages.
2020-07-30 16:58:12 +03:00
Andrii Doroshenko (Xrayez)
63720648e8 Cleanup obsolete tests from displaying in help 2020-07-29 15:07:16 +03:00
Andrii Doroshenko (Xrayez)
3f77056dc6 Add test suite for Variant
Added a test case for `VariantWriter` and `VariantParser` overflows.
2020-07-28 18:34:55 +03:00
Aaron Franke
56e2c6c704
Make all String float conversion methods be 64-bit 2020-07-27 18:38:53 -04:00
Gordon
968bfdb72a Crash when debugging tests by disabling thread_local in /MT context 2020-07-26 18:24:52 +01:00
Rémi Verschelde
b35be146da
Merge pull request #40720 from Xrayez/modules-tests
Enable support for C++ modules tests
2020-07-26 17:04:41 +02:00
Andrii Doroshenko (Xrayez)
60f53140b8 Enable support for C++ modules tests
Modules-specific tests can be written under respective module folders.
Each module should have "tests" folder created with the tests implemented
as `doctest` headers, so they can be collected by the buildsystem and
included directly in `tests/test_main.cpp` to be compiled.
2020-07-26 17:41:46 +03:00
Rémi Verschelde
a3a980eb0d SCons: Build tests/ and main/ in cloned environments
Allows switching `tests=yes`/`no` and rebuilding only tests and main,
instead of the whole engine.

Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>
2020-07-26 16:03:11 +02:00
Andrii Doroshenko (Xrayez)
9f649efe5d Move tests to the top-level directory 2020-07-26 00:06:07 +03:00