Commit Graph

65 Commits

Author SHA1 Message Date
Pablo Andres Fuente
d1338528f9 Fix file loggin log rotation
Fixes #97066

`RBSet` were used on `RotatedFileLogger` because it guarantees that
iterating it is done via `operator<`. This is important because
`RotatedFileLogger` depends on this behavior to delete the oldest log file.
On #61194 `HashSet` was added and all `RBSet` uses were replaced by
`HashSet`.
When that happened, the iteration in order is guaranteed to be the insertion
order, wich made that `RotatedFileLogger` delete the newest log file.
As a bonus, I added unit test for `RotatedFileLogger` and `CompositeLogger`.
2025-02-10 21:57:07 +01:00
Thaddeus Crews
f0f5319b0b
Merge pull request #100107 from Faless/fix/net_tests
Some checks are pending
🔗 GHA / 📊 Static checks (push) Waiting to run
🔗 GHA / 🤖 Android (push) Blocked by required conditions
🔗 GHA / 🍏 iOS (push) Blocked by required conditions
🔗 GHA / 🐧 Linux (push) Blocked by required conditions
🔗 GHA / 🍎 macOS (push) Blocked by required conditions
🔗 GHA / 🏁 Windows (push) Blocked by required conditions
🔗 GHA / 🌐 Web (push) Blocked by required conditions
[Net] Fix TCP/UDP server network tests
2025-02-05 18:50:44 -06:00
Rémi Verschelde
35080c6df3 Merge pull request #100970 from anknetau/ank/godot-add-test-cases-for-uid-strings
Add some tests for `uid://` encoding and decoding
2025-01-10 23:05:59 +01:00
Andres Kievsky
2b5dd99d72 Add some tests for uid:// encoding and decoding 2025-01-10 23:41:12 +11:00
Yufeng Ying
34d8255947 Force build editor with regex module, remove checking code.
Fix include.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-07 19:43:23 +08:00
AThousandShips
25ecf5ec83
[Core] Fix UID encoding
Fixes edge case where `0` encoded as `uid://` instead of `uid://a`, and
fixes the size of the temporary buffer storing encoded UID strings.
2024-12-31 15:20:09 +01:00
A Thousand Ships
a1846b27ea
Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
2024-12-23 16:35:02 -05:00
HP van Braam
240f510fa7 Core ubsan fixes
This fixes UBSAN errors reported by running our testsuite, importing the
TPS demo, and running the TPS demo. I have tried, wherever possible, to
fix issues related to reported issues but not directly reported by UBSAN
because thse code paths just happened to not have been exercised in
these cases.

These fixes apply only to errors reported, and caused by, core/

The following things have been changed:

* Make sure there are no implicit sign changing casts in core.
* Explicitly type enums that are part of a public API such that users of
  the API cannot pass in wrongly-sized values leading to potential stack
  corruption.
* Ensure that memcpy is never called with invalid or null pointers as
  this is undefined behavior, and when the engine is built with
  optimizations turned on leads to memory corruption and hard to debug
  crashes.
* Replace enum values only used as static values with constexpr static
  const values instead. This has no runtime overhead. This makes it so
  that the size of the enums is explicit.
* Make sure that nan and inf is handled consistently in String.
* Implement a _to_int template to ensure that all of the paths use the
  same algorhithm, and correct the negative integer case.
* Changed the way the json serializer precision work, and added tests to
  verify the new behavior. The behavior doesn't quite match master in
  particulary for negative doubles as the original code tried to cast -inf
  to an int. This then led to negative doubles losing all but one of
  their decimal points when serializing. Behavior in GDScript remains
  unchanged.
2024-12-18 14:31:12 +01:00
Thaddeus Crews
8f16f864a6
Merge pull request #99765 from dalexeev/core-fix-json-from-to-native
Core: Fix `JSON.{from,to}_native()` issues
2024-12-10 14:15:53 -06:00
Fabio Alessandrelli
e5807b2adf [Net] Fix TCP/UDP server network tests
Some tests have been removed since there's no way to guarantee they will
pass.

Other tests have been refactored to ensure proper waiting, and taking
into account potential out-of-order delivery (which is unlikely in test
scenarios but expecting a specific order on a UDP socket is wrong and
OSes makes no promises of ordered delivery on localhost).
2024-12-06 18:00:49 +01:00
Pablo Andres Fuente
df2c2ca3c3 Fix TCPServer "Should disconnect client" test
"Should disconnect client" test was failing randomly on Mac CI tests, so
this PR is making it more reliable reading on the closed client instead of
writing to it
2024-12-03 09:46:37 -03:00
Pablo Andres Fuente
0c03db09f8 Add unit tests for TCPServer
This PR aims to help "fix" #43440
2024-11-29 12:55:49 +01:00
Danil Alexeev
bd1a35ce9e
Core: Fix JSON.{from,to}_native() issues 2024-11-29 12:43:06 +03:00
Pablo Andres Fuente
2c9de1d9d2 Add unit tests for UDPServer
This PR aims to help "fix" #43440
2024-11-22 23:08:05 -03:00
Thaddeus Crews
c35e4c41d2 Merge pull request #97716 from pafuent/add_half_precision_floating_point_to_stream_peer
Add half precision floating point support to `StreamPeer` and `FileAccess`
2024-11-22 14:54:19 -06:00
Pablo Andres Fuente
eb86670f94 Add half precision floating point support to StreamPeer
Closes godotengine/godot-proposals#5983

Adds put/get methods to `StreamPeer` that handles half precision
floating point values.
Adds endode/decode half precision floating point to `marshalls`.
Adds `get_half` and `store_half` to `FileAccess`

Co-Authored-By: "Alfonso J. Ramos" <theraot@gmail.com>
2024-11-12 08:46:52 -03:00
Danil Alexeev
9ba098b670
Core: Add typed dictionary support for binary serialization 2024-11-12 10:18:56 +03:00
Rémi Verschelde
a7d0464e9e
Merge pull request #95931 from pafuent/adding_packet_peer_tests
Add unit tests for `PacketPeer`
2024-10-01 17:30:36 +02:00
Pablo Andres Fuente
ff10dee946 Add unit tests for StreamPeer and StreamPeerBuffer
Partially fixes #43440
2024-10-01 12:25:11 -03:00
Pablo Andres Fuente
0a41a715da Add unit tests for PacketPeer
Partially fixes #43440
2024-10-01 12:19:41 -03:00
A Thousand Ships
194bdde947
Cleanup of raw nullptr checks with Ref
Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
2024-08-31 15:01:09 +02:00
K. S. Ernest (iFire) Lee
71bdbcdfb1 Ability to convert native engine types to JSON and back.
Implements support for all engine types in JSON encoding/decoding

Co-Authored-By: Juan <reduzio@gmail.com>
Co-Authored-By: Rémi Verschelde <rverschelde@gmail.com>
2024-08-29 10:57:15 -07:00
Hugo Locurcio
0445ccf428
Fix Image CowData crash when baking large lightmaps
This switches to 64-bit integers in select locations of the Image
class, so that image resolutions of 16384×16384 (used by
lightmap texture arrays) can be used properly. Values that are larger
should also work.

VRAM compression is also supported, although most VRAM-compressed
formats are limited to individual slices of 16384×16384. WebP
is limited to 16383×16383 due to format limitations.
2024-07-19 16:04:30 +02:00
A Thousand Ships
832695eb2c
[Tests] Fix various unit tests on minimal builds 2024-07-18 15:17:28 +02:00
kobewi
5514b2c70c Use subfolder for temporary test files 2024-06-05 20:31:42 +02:00
killzebug
53a95d6a00 Suppressed expected errors for uncached resources. 2024-04-22 23:50:20 +03:00
RevoluPowered
65d076b78d
Add unit test for resolve_hostname 2024-04-10 14:19:04 +02:00
Danil Alexeev
c30bec7fca
Core: Add typed array support for binary serialization 2024-03-20 11:37:41 +03:00
A Thousand Ships
3a707b1f54
Fix some additional errors with 3D disabled
* Disabled 2D navigation tests as they do not work
* Disabled tests for primitive meshes
* Unbound some `Mesh` methods that rely on 3D resources
* Unexposed `World3D` as it depends on physics (and isn't useful)
* Unexposed some `Viewport` vrs related properties that had unexposed
  methods
2024-02-23 20:58:56 +01:00
A Thousand Ships
d7a72d72e6
Fix running tests in template builds 2024-02-22 18:05:42 +01:00
rsburke4
dec2269bca Added error to catch conversion on invalid image 2023-12-10 15:06:22 -05:00
A Thousand Ships
7726ed6740 Fix errors when testing Resource
Replaces `get_meta` with `has_meta` for cases where the meta is expected
to be empty.
2023-09-09 08:20:05 +02:00
clayjohn
0045dc204c Revert "Implement loading DDS textures at run-time"
This reverts commit 34ab1c8a36.
2023-08-29 14:25:16 +02:00
Rémi Verschelde
3907e53ff6
SCons: Disable C++ exception handling
Upon investigating the extremely slow MSVC build times in #80513, I noticed
that while Godot policy is to never use exceptions, we weren't enforcing it
with compiler flags, and thus still included exception handling code and
stack unwinding.

This is wasteful on multiple aspects:

- Binary size: Around 20% binary size reduction with exceptions disabled
  for both MSVC and GCC binaries.
- Compile time:
  * More than 50% build time reduction with MSVC.
  * 10% to 25% build time reduction with GCC + LTO.
- Performance: Possibly, needs to be benchmarked.

Since users may want to re-enable exceptions in their own thirdparty code
or the libraries they compile with Godot, this behavior can be toggled with
the `disable_exceptions` SCons option, which defaults to true.
2023-08-16 10:23:34 +02:00
Rémi Verschelde
835957b1fc
Merge pull request #79980 from bruvzg/fix_test_str_errs
[String] Fix Unicode parsing error message encoding and related JSON tests.
2023-08-09 15:20:16 +02:00
Marcin Nowak
34ab1c8a36 Implement loading DDS textures at run-time 2023-07-31 21:31:26 +02:00
bruvzg
84a6f0d232 [String] Fix Unicode parsing error message encoding and related JSON tests. 2023-07-28 12:27:01 +03:00
Maxim Kulkin
058604f5b8 Fix crash when saving resources with circular references
When saving resources, marking of already seen resources was
done too late, causing infinite loop traversing referenced resources
and eventual stack overflow. The change marks traversed resource
before descending to it's children, thus when this resource is
encountered again, it is already marked as seen and traversal stops.
2023-07-14 19:20:04 +02:00
Yuri Sizov
e88934cb74 Merge pull request #74238 from bitsawer/fix_image_convert
Fix `Image.convert()` overwriting custom mipmaps
2023-07-12 17:15:39 +02:00
RedMser
427b293c7d Disallow invalid escape sequences in JSON.parse 2023-06-30 21:28:36 +02:00
angel-721
ab4e89ecde
Add HTTPClient unit tests 2023-06-21 11:53:55 +02:00
andybarcia
553f4f8dce
Improve error reporting when parsing CSV translation file
Fixes #46682.

Also fix unit test suite to separate generic FileAccess CSV testing
from using CSV as translation. And add more CSV translation tests.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-06-19 12:47:44 +02:00
MewPurPur
a8412c12da Standardize and Optimize blue robot SVG
Co-authored-by: Andre Vallestero <39736205+AndreVallestero@users.noreply.github.com>
2023-06-12 18:12:40 +02:00
Kory Postma
c8cac39446 Grayscale fix for Image::premultiply_alpha() and Image::convert(FORMAT_L8) while using REC.709, with added test case 2023-05-27 18:01:44 -05:00
bitsawer
5a9d7fd8a6 Fix Image.convert() overwriting custom mipmaps 2023-03-02 16:46:06 +02:00
myaaaaaaaaa
132e987633 Fail instead of segfaulting in IO tests 2023-01-31 02:21:27 -05:00
bruvzg
db7d8c2d87
[GDExtension] Expose some low level functions and String operators. 2023-01-19 12:50:49 +02:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Hendrik Brucker
f906ff8f89 [Tests] Replace Math::is_equal_approx with == and doctest::Approx 2022-11-05 02:28:00 +01:00
Micky
ebf86c96e9 Rename Image's get_rect to get_region
Also renames its parameter to from "rect" to "region".
2022-11-01 23:35:48 +01:00