Commit Graph

209 Commits

Author SHA1 Message Date
Chris Thrasher
82b9821a8a Add clang-tidy bugprone-* checks 2023-04-12 19:53:36 -06:00
Chris Thrasher
cafaa1c153 Add clang-tidy performance-* checks 2023-04-10 10:08:13 -06:00
binary1248
ea4c448a85 Add support for installing and using the Mesa 3D library for OpenGL rendering. 2023-04-06 11:15:56 -06:00
Chris Thrasher
f371a99b39 Implement sf::String in terms of std::u32string 2023-04-04 15:47:34 -06:00
binary1248
7004db1cd9 Added sf::RenderWindow, sf::Shader and sf::Window tests. 2023-04-04 10:27:21 +02:00
Chris Thrasher
ebe4b3c437 Add tests for sf::String 2023-04-03 21:23:43 -06:00
Jonny
741fe219da
Use built-in CMake support for iOS
* Use built-in iOS support for cmake and expand tests to cover more configurations
* Adjust CI builds
* Update examples version

---------

Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
2023-04-03 23:36:33 +02:00
Chris Thrasher
92e5a1e4e6 Implement move semantics for sf::Cursor 2023-04-03 01:02:26 -06:00
binary1248
5048c4d801 Added sf::Texture tests. 2023-03-30 22:24:40 +02:00
Jim-Marsden
a8bc8cf889 Added move constructor, and move assignment operator. 2023-03-29 23:48:05 +02:00
Chris Thrasher
2d2f684786 Fix clang-tidy-16 errors 2023-03-28 19:54:06 -06:00
binary1248
acba3e6165 Replaced xvfb-run with manually starting Xvfb and running fluxbox to emulate a window manager and combined test and coverage steps into a single step. 2023-03-27 19:46:07 -06:00
Chris Thrasher
0b62543942 Don't automatically run tests after build
The runtests target must be used on Windows for the sake of code
coverage. However we can't use that target on all other platforms
because on some non-Windows platforms like Android, the tests don't
even get configured. If you try to build a target that doesn't exist
you get a hard failure. Using CTest is better because it will still
return zero even if no tests are found as is the case on Android.
2023-03-14 20:23:17 -06:00
Chris Thrasher
b6c54ac589 Use unity builds to speed up clang-tidy runtime 2023-03-14 10:08:23 -06:00
Lukas Dürrenberger
90f05ac4e8 Switch to using Documentation IP ranges in tests
Documentation IP ranges are define in RFC 5737 and are 'safe' address
for documentation purposes
2023-03-09 16:40:01 -07:00
binary1248
f4e0c4b4c0 Make moving Shapes, swapping Textures and swapping VertexBuffers noexcept. 2023-03-07 16:32:35 -07:00
Chris Thrasher
41aa062272 Add modernize-use-auto clang-tidy check 2023-02-15 09:42:50 -07:00
Chris Thrasher
2a2ddee221 Disable unreliable tests 2023-02-15 09:39:11 -07:00
Chris Thrasher
9d0b2ba592 Add tests for sf::Cursor 2023-02-14 07:34:07 -07:00
Chris Thrasher
cdf8ab38fb Add tests for sf::VertexBuffer 2023-02-13 11:47:53 -07:00
Chris Thrasher
2af65286b7 Add tests for sf::WindowBase 2023-02-08 00:22:42 -07:00
Jim-Marsden
976bbda911 Drawable Test 2023-01-24 16:27:11 -07:00
Chris Thrasher
dd83189fae Enable move semantics for SoundFile types
Funny how the addition of a forward declaration resulted in
accidentally disabling move semantics for two types. We ought to
be careful that build time improvements don't have runtime
performance impacts.
2023-01-22 15:50:53 -07:00
Norm Evangelista
6ef8e487cc Added readability-qualified-auto, -redundant-access-specifiers
Fixed clang-format escapes

Fixed OSX clang-tidy issues

Collapsed extraneous lines

Fixed clang-format escape
2023-01-19 15:53:40 -07:00
Chris Thrasher
84f56d0936 Add option for skipping tests that require an attached display 2023-01-18 16:06:00 -07:00
Chris Thrasher
b128fcd3df Add tests for sf::Texture 2023-01-18 16:06:00 -07:00
Chris Thrasher
b2e918bafc Simplify how test runner command is created 2023-01-18 16:06:00 -07:00
Chris Thrasher
badb388507 Remove unnecessary casts 2023-01-11 15:30:22 -07:00
Chris Thrasher
098f6927d2 Prevent using a temporary sf::SoundBuffer with sf::Sound 2023-01-06 15:46:22 -07:00
Chris Thrasher
0c2f7da9f9 Prevent using a temporary sf::Texture with sf::Sprite 2023-01-06 15:46:22 -07:00
Chris Thrasher
3f4bb1ae12 Prevent constructing sf::Text with a temporary sf::Font
By deleting this constructor overload, it fails to compile if
you pass a temporary font to this parameter slot. That includes
code like

  sf::Text text("", sf::Font());

but more importantly it prohibits code like this

  sf::Font getFont()
  {
    sf::Font font;
    // load a font...
    return font;
  }

  sf::Text text("", getFont());

The same idea can be applied to setFont() to prevent setting fonts
from a temporary.

Credit to Jonny for the idea

Co-authored-by: JonnyPtn <jonathan.r.paton@googlemail.com>
2023-01-06 10:21:00 -07:00
Chris Thrasher
718195bf25 Mark move operators as noexcept 2023-01-04 09:49:20 -07:00
Jim-Marsden
34b6323929 Changed to namespace 2023-01-01 14:31:26 -07:00
Jim-Marsden
7884efc49e Replaced Header Guards with Pragma Once 2022-12-27 20:08:11 +01:00
Chris Thrasher
e8fa5d7d31
Add CI job for Clang on Windows 2022-12-14 15:26:08 -07:00
Chris Thrasher
3b6db4d18c Enforce variable case 2022-12-12 16:10:03 -07:00
Chris Thrasher
4807c779a7 Apply warnings to install test
Because the install test project can't access SFML CMake functions,
these warnings are only applied when building the install tests as
a part of SFML.
2022-11-29 00:47:32 -07:00
jim
1d4db22d62 Added move constructor/operator 2022-11-19 19:52:45 -07:00
Jonny Paton
e4bffe5b84 Rename test files to be unique 2022-10-23 16:39:12 +02:00
Chris Thrasher
3d02d490bd Hide doctest sources from compile commands database
This ensure that tools like run-clang-tidy don't try to analyze them
and better mimmicks how Doctest would behave if we were depending on
Doctest via find_package instead.
2022-10-17 18:29:56 -06:00
Chris Thrasher
229e3f61f4 Use doctest-provided main implementation 2022-10-16 14:55:33 -06:00
Chris Thrasher
e4f81af337 Test install interface
Skip Android, iOS, and Framework builds simply because I can't get
them to work and don't want that holding up getting the rest of the
install tests merged.

Skip the Static DRM install test because there's a bug in the install
that needs to be fixed.
2022-10-15 09:07:49 +02:00
Chris Thrasher
ff685de1bf Ensure add_custom_command uses VERBATIM
https://cmake.org/cmake/help/latest/command/add_custom_command.html

"Use of VERBATIM is recommended as it enables correct behavior."

The docs basically say that this is required.
2022-10-12 00:23:35 +02:00
Chris Thrasher
b848a7b29a Only reference the project's directories, not parent directories 2022-10-12 00:23:35 +02:00
Chris Thrasher
9feef3708d Test existence of copy and move semantics 2022-10-10 11:46:55 -06:00
Chris Thrasher
0e475f3f50 Test reinterpreting an sf::Color as a std::uint8_t* 2022-10-05 20:26:25 +02:00
Chris Thrasher
939ec267df Improve const correctness 2022-10-01 23:19:52 +02:00
Chris Thrasher
e44a4b305d Simplify operator<< implementations 2022-10-01 23:19:52 +02:00
Chris Thrasher
25fa30afc6 Make test case names more readable
Test output now shows the module name left-aligned so you can easily
browse to see what modules have what tests and know what module a
failing test is coming from.
2022-10-01 23:19:52 +02:00
Chris Thrasher
acabaadc0b Remove unnecessary sf:: usage 2022-10-01 23:19:52 +02:00
Chris Thrasher
28a4a88832 Add more tests for sf::Packet 2022-10-01 12:35:29 -06:00
Chris Thrasher
12aaa4d08a Use macros for test abstractions to preserve line number information 2022-10-01 12:35:29 -06:00
Chris Thrasher
abc8d858c3 Only include header under test 2022-10-01 12:35:29 -06:00
Chris Thrasher
3a3935d005 Replace sf::Uint64 with std::uint64_t 2022-09-13 11:15:03 -06:00
Chris Thrasher
05690b963d Replace sf::Int64 with std::int64_t 2022-09-13 11:15:03 -06:00
Chris Thrasher
b94df9e0d8 Let tests succeed even if nullopt is returned
This is the desire behavior when the network fails so we can't
just fail the test when this happens.
2022-09-12 15:58:51 -06:00
Chris Thrasher
105ff68a6a Time out test for public IP address
On poor network connections, the call to getPublicAddress may hang
indefinitely. If it is to succeed, let's require that it succeed
within a reasonable time frame to put an upper limit on how long
this test takes to run.
2022-09-12 15:58:51 -06:00
Chris Thrasher
e294090c8e Replace sf::Uint32 with std::uint32_t 2022-09-12 15:36:55 -06:00
Chris Thrasher
056f66a2b8 Replace sf::Int32 with std::int32_t 2022-09-12 15:36:55 -06:00
Chris Thrasher
ff9c9131b3 Replace sf::Uint16 with std::uint16_t 2022-09-12 21:36:13 +03:00
Chris Thrasher
e21ae3204e Replace sf::Int16 with std::int16_t 2022-09-12 21:36:13 +03:00
Chris Thrasher
50cec7d2ed Treat each test case as a unique test 2022-09-10 20:03:25 +03:00
Chris Thrasher
e2528de20a Replace sf::Uint8 with std::uint8_t 2022-09-09 10:28:53 +02:00
Chris Thrasher
af34794123 Replace sf::Int8 with std::int8_t 2022-09-09 10:28:53 +02:00
Chris Thrasher
82b48a7520 Use std::size_t 2022-09-07 22:23:22 +02:00
Chris Thrasher
45986c6400 Avoid opening namespace std 2022-09-05 23:35:25 +02:00
Chris Thrasher
8561101b11 Add conversions between sf::Time and std::chrono::durations 2022-09-05 23:35:25 +02:00
Chris Thrasher
b7510fd09e Fix formatting and style
Use all lower_case commands with no space between the command name
and the open parentheses. Don't repeat conditional in else() and
endif() calls.
2022-08-22 11:26:57 +08:00
Chris Thrasher
49fd5887c8 Add tests for SFML/Config.hpp 2022-08-03 23:39:37 +02:00
Chris Thrasher
a47eb8320a Remove vendored doctest header 2022-07-20 08:56:59 +02:00
Chris Thrasher
4f52793f7d Run clang-format 2022-07-11 20:04:56 +02:00
metaquarx
88e9f82bee Add '.clang-format' file, CI integration, and formatting exceptions
Co-authored-by: Vittorio Romeo <vittorio.romeo@outlook.com>
Co-authored-by: Chris Thrasher <chrisjthrasher@gmail.com>
Co-authored-by: kimci86 <kimci86@hotmail.fr>
2022-07-11 20:04:56 +02:00
Bambo-Borris
c6f7fcaa2a Add tests for sf::MemoryInputStream 2022-06-28 14:33:21 +02:00
Vittorio Romeo
8c8d97c6c9 IpAddress is always valid 2022-06-28 00:31:12 +02:00
Chris Thrasher
fd3526f742 Use <> for test utilities includes
SFML convention is to only use "" includes when the header is in
the same directory as the file including it. Because these test
util headers are in a separate directory, it makes more sense to
include them via <>.
2022-06-27 00:22:16 +02:00
Chris Thrasher
4047909725 Remove unnecessary includes 2022-06-27 00:22:16 +02:00
Chris Thrasher
a57640c2c8 Require stringification for all tested types
This ensures that if a printing function is not provided, compilation
fails. This prevents problems where a header is accidentally removed
that was previously providing an operator<< overload or prevents
new tests from being added without print support for all directly
tested types.
2022-06-27 00:22:16 +02:00
Chris Thrasher
3925139f4d Improve test coverage of sf::Rect 2022-06-26 15:47:30 +02:00
Chris Thrasher
b009151e89 Improve test coverage of sf::Color 2022-06-26 15:47:30 +02:00
Chris Thrasher
44d3d63ade Reduce the scope of helper class 2022-06-26 02:14:53 +02:00
Chris Thrasher
0812054e02 Remove trailing whitespace 2022-06-25 21:32:55 +02:00
Vittorio Romeo
8a2aa6397f Explicitly instantiate float vector members in cpp 2022-06-24 18:47:28 +02:00
Chris Thrasher
e4e9b290b1 Add tests for sf::IpAddress 2022-06-23 18:47:23 +02:00
Vittorio Romeo
6cd07a043f 'sf::Image::copy' returns a 'bool' to signal success/failure 2022-06-21 16:40:22 +02:00
Bambo-Borris
8b3723a52b Add tests for sf::Image 2022-06-21 15:14:27 +02:00
Chris Thrasher
6a59ab0051 Add tests for sf::ConvexShape 2022-06-09 10:05:29 +02:00
Chris Thrasher
3203c3927f Add tests for sf::RenderStates 2022-06-07 08:25:52 +02:00
Chris Thrasher
58e93ddd19 Add tests for sf::View 2022-06-01 08:09:29 +02:00
Chris Thrasher
60131b19ef Add tests for sf::Glyph 2022-06-01 08:09:29 +02:00
Chris Thrasher
7dd001e5c0 Simplify approximate comparisons of SFML types
Co-authored-by: kimci86 <kimci86@hotmail.fr>
2022-05-25 13:36:12 +02:00
Chris Thrasher
1e6dc82304 Add tests for sf::CircleShape 2022-05-17 20:30:17 +02:00
Chris Thrasher
049e3ce8f2 Increase precision of operator<<(Vector2<T>) 2022-05-17 20:30:17 +02:00
Chris Thrasher
88515b2fca Add polar coordinates constructor for sf::Vector2<T> 2022-05-17 20:30:02 +02:00
Chris Thrasher
0785093ebc Use sf::Vector2<T> for numeric parameter pairs 2022-05-17 08:33:11 +02:00
Chris Thrasher
488b139ea7 Fix conversion warning 2022-05-16 19:05:35 +02:00
Bambo-Borris
b2ab6d6ab3 Add extension methods to Vector3<T>
Includes relevant tests and updates TestUtilities to feature ApproxVec2 & ApproxVec3
2022-05-16 08:59:42 +02:00
Chris Thrasher
829cf3b502 Apply compiler warnings to test utilities 2022-05-09 15:38:24 +02:00
Chris Thrasher
c0a6cf1f0c Remove unnecessary lossy conversions in test utilities
Both ApproxVec and ApproxDeg accept a double then convert that to
a float just to then convert it back to a double. We can save an
extra lossy conversion by just accepting a float instead of a double
in the first place.
2022-05-04 09:03:04 +02:00
Chris Thrasher
1e560ababd Add tests for sf::err 2022-05-02 09:53:04 +02:00
Chris Thrasher
2a5ce3c989 Apply compiler warnings to tests 2022-05-02 08:39:02 +02:00