Commit Graph

187 Commits

Author SHA1 Message Date
Juan Linietsky 0dd65378e7 Add support for command-line user arguments.
Implements the standard Unix double dash (--) commandline argument:
* Arguments after a double dash (--) are ignored by Godot and stored for the user.
* User can access them via `OS.get_cmdline_user_args()`

Example:

`godot.exe scene_to_run.tscn --fullscreen -- --start-level 2`
2022-08-01 00:56:59 +02:00
Hugo Locurcio 208435fb90
Add a test suite for OS 2022-07-29 01:55:43 +02:00
Hugo Locurcio 4b42379c8f
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much
easier to find the methods when searching in the class reference.
2022-07-28 18:46:59 +02:00
reduz 67a260d63f Implement a Worker ThreadPool
This PR implements a worked thread pool. It uses a fixed amount of threads in a pool and allows scheduling tasks
that can be run on threads (and then waited for). It satisfies the following use cases:

* HTML5 thread count is fixed (and similar restrictions are known in consoles) so we need to reuse threads.
* Thread spawning is slow in general, so reusing threads is faster anyway.
* This implementation supports recursive waiting for tasks, making it less prone to deadlocks if threads from the pool also run tasks.

After this is approved and merged, subsequent PRs will be needed to replace the ThreadWorkPool usage by this class.
2022-07-22 11:46:48 +02:00
cabinboy1031 7730001390 Implemented tests for Plane getters and setters.
Added tests for intersection and plane-point methods.
2022-07-05 12:55:05 +02:00
reduz 45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
reduz 746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
reduz 8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
Rémi Verschelde 5c52b30471
Merge pull request #60529 from timothyqiu/theme-validation 2022-05-02 10:49:14 +02:00
Aaron Franke 0ae00a07d6
Rename variable names for some singletons 2022-04-26 22:53:50 -05:00
Rémi Verschelde e9e2aaf812
Merge pull request #60513 from Calinou/default-font-add-msdf-mipmap
Add MSDF and mipmap generation project settings for the default font
2022-04-26 22:39:55 +02:00
Haoyu Qiu d8c04cda3a Validate theme type/item names 2022-04-26 19:54:43 +08:00
Hugo Locurcio 43c34bf611
Add MSDF and mipmap generation project settings for the default font
This can be used to improve Label3D and scaled Control appearance
in prototypes.
2022-04-25 16:47:44 +02:00
Paulb23 c1d445f1e5 Add inital TextEdit UnitTests 2022-04-22 21:09:48 +01:00
Paulb23 5e4e4967fe Use Input::push_input for tests plus extra mouse testing 2022-04-22 17:39:12 +01:00
Rémi Verschelde c99a1af0fb Remove unused legacy tests
They haven't been updated for years and still use the old MainLoop
basic framework instead of the new doctest one.

They're of dubious quality and best redone from scratch using the
new framework.
2022-04-07 00:38:44 +02:00
bruvzg 29199579f7
Add sub-pixel glyph positioning support. 2022-02-12 19:55:52 +02:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Hugo Locurcio a6e8cdae66
Add a unit test suite for Animation 2022-02-06 21:33:22 +01:00
Rémi Verschelde 5f56d385b0
Core: Move Rect2i to its own `rect2i.h` header
And take the opportunity to improve interdependencies a bit with forward
declares where possible.
2022-02-04 14:17:30 +01:00
Hugo Locurcio 84a69d7429 Improve the default project theme
The new default project theme uses StyleBoxFlat extensively for
a more modern design and better scalability to multiple resolutions.

SVG icons are now used in place of PNG icons. While this does not
allow for true vector-based icon drawing (icons are still rasterized
at load-time), this makes the design work easier for contributors
and opens the door to vector drawing in the future (e.g. with polygons
or SDFs).

Like for editor icons, the SVG header file is now built automatically
when a SVG file is changed. This removing the need for running
`make_header.py` manually (TODO).

The "Use Hidpi" project setting has been removed in favor of a
"Default Theme Scale" project setting, which allows creating the
default theme at a higher/lower scale than the default.
This can be used when designing GUIs with a high base resolution
to ensure crisp visuals.

Co-authored-by: Yuri Sizov <yuris@humnom.net>
2022-01-19 18:46:01 +03:00
Aaron Franke d9506cade1
Add tests for Vector2/Vector2i/Vector3/Vector3i 2022-01-14 01:59:55 -06:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Aaron Franke 99a282f631
Move and organize tests into subfolders 2021-11-07 00:43:31 -06:00
bruvzg 0c0b5c84b0 Implement TextServer GDExtension interface, remove TextServer GDNative interface. 2021-10-01 15:13:29 +03:00
Paulb23 ce064348fa Add CodeEdit breakpoint unit tests 2021-09-01 16:46:04 +01:00
Paulb23 55a20129d6 Create framework for testing Signals 2021-09-01 16:46:04 +01:00
Paulb23 427d3d7207 Allow unit testing SceneTree Ojects 2021-09-01 16:46:04 +01:00
Aaron Franke f64fea1b23
Add Time singleton 2021-06-11 09:32:39 -04:00
jfons f8e34209af Fix some warnings raised by GCC-11.1 2021-05-25 17:23:53 +02:00
Hugo Locurcio 114d556a42
Add a test suite for Vector
This test suite is based on the LocalVector test suite with significant
changes made.
2021-05-19 16:37:39 +02:00
Hugo Locurcio dd51fc77b5
Add a test suite for Translation 2021-05-17 02:02:17 +02:00
Hugo Locurcio 217f1f891b
Add a test suite for Dictionary
Co-authored-by: Sarav Noor Singh <saravnoorsingh@Saravs-MBP.T-mobile.com>
2021-03-31 01:14:18 +02:00
Daniel Kříž f07552ba92 add tests for path3d 2021-03-29 10:13:53 +02:00
Maximilian Mayer f12d205c1f Add unit tests for HashingContext 2021-03-07 20:33:08 +01:00
James Gordon a26d4b1727 Added test file and test cases 2021-02-27 13:16:04 +00:00
Rémi Verschelde 5a10f52ee8
Merge pull request #45914 from HenryWConklin/45841-xml-entities
Add support for numeric XML entities to XMLParser
2021-02-24 13:03:46 +01:00
Hugo Locurcio efd122a99a
Add a test suite for Resource 2021-02-20 19:47:20 +01:00
Sarav Noor Singh dd9c8d85fa
Add a test suite for Array 2021-02-19 17:40:57 +01:00
Henry Conklin c6a911f037 Add support for numeric XML entities to XMLParser
* Add support for decimal numeric entities to String::xml_unescape
* Add more error checks to String::xml_unescape
* Refactor XMLParser to use String::xml_unescape instead of an internal
implementation
2021-02-14 11:00:25 -06:00
Manolis Papadeas 7a918bacca Add a test suite for the Image class 2021-02-06 01:09:02 +02:00
Rémi Verschelde 6ddfc8e718
Merge pull request #44797 from a-ivanov/marshall-core-unit-tests
Marshall core unit tests
2021-01-24 20:41:57 +01:00
Anton Ivanov 8aed1ee8f7
Unit tests for encoding/decoding of base types 2021-01-24 17:15:07 +03:00
AndreaCatania 5ba60c17dd Add function `LocalVector::remove_unordered`
Added LocalVector unit tests.
2021-01-11 13:47:31 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcus Brummer e455ca2f2f Added Geometry2D unit tests 2020-12-30 21:11:09 +01:00
reduz 37c6434e16 Add a paged array template
Used for reusable stacks, or filling arrays from multiple threads efficiently.
2020-12-21 15:06:50 -03:00
Andrii Doroshenko (Xrayez) ed7014c67a Add test suite for `FileAccess` 2020-12-11 16:05:18 +02:00
Andrii Doroshenko (Xrayez) 932acad53f Add test suite for `RandomNumberGenerator` 2020-12-07 13:51:03 +02:00
Fabio Alessandrelli 502ff74fee
Merge pull request #43536 from jonbonazza/hmac
feat: HMAC support in Crypto APIs
2020-12-03 11:08:16 +01:00
Jon Bonazza d5925fd522 feat: HMAC support in Crypto APIs 2020-11-26 18:39:56 -08:00
bruvzg 493da99269
[Complex Text Layouts] Implement TextServer interface. Implement Fallback TextServer. 2020-11-26 13:55:26 +02:00
Rémi Verschelde 6221210c6c
Merge pull request #43727 from Calinou/test-add-aabb
Add a test suite for AABB
2020-11-23 09:30:44 +01:00
Hugo Locurcio 6f24bc3e47
Add a test suite for AABB 2020-11-20 19:44:08 +01:00
Rémi Verschelde 34895e7b28
Merge pull request #43583 from Calinou/test-add-object
Add a test suite for Object
2020-11-20 14:03:12 +01:00
Rémi Verschelde 29f34782f0
Merge pull request #43514 from Calinou/test-add-rect2-rect2i
Add a test suite for Rect2 and Rect2i
2020-11-20 13:40:12 +01:00
Hugo Locurcio e924bf9dec
Add a test suite for Object 2020-11-20 13:24:14 +01:00
Hugo Locurcio 7cb21c21b3
Add a test suite for Rect2 and Rect2i 2020-11-20 12:53:37 +01:00
Rémi Verschelde d87e192be6
Merge pull request #43517 from Calinou/test-add-json
Add a test suite for JSON
2020-11-20 12:47:27 +01:00
Andrii Doroshenko (Xrayez) dc980e5f96 doctest: Do not override command-line options
Those options were likely copy-pasted from documentation examples.
This change also allows to break in the debugger by default when
assertions fail, and this can be configured via command-line interface.
2020-11-20 13:21:45 +02:00
Hugo Locurcio f91a6eba10
Add a test suite for ConfigFile 2020-11-16 14:35:10 +01:00
Rémi Verschelde 7a6eab2ce3
Merge pull request #43578 from Calinou/test-add-nodepath
Add a test suite for NodePath
2020-11-16 12:54:26 +01:00
Rémi Verschelde db98a61913
Merge pull request #43572 from Calinou/test-add-pckpacker
Add a test suite for PCKPacker
2020-11-16 12:54:02 +01:00
Hugo Locurcio bf82da3d0f
Add a test suite for NodePath 2020-11-15 22:28:25 +01:00
Hugo Locurcio 9574a834e5
Add a test suite for PCKPacker 2020-11-15 20:05:46 +01:00
Hugo Locurcio 038bbf7b6b
Add a test suite for JSON
This test suite doesn't attempt to test error/invalid cases since
the current JSON parser has a lot of false negatives.
2020-11-14 00:13:32 +01:00
Hugo Locurcio 8fefbda818
Add a test suite for Curve 2020-11-13 22:46:05 +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 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) 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
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) 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) 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
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
Andrii Doroshenko (Xrayez) 9f649efe5d Move `tests` to the top-level directory 2020-07-26 00:06:07 +03:00