Commit Graph

137 Commits

Author SHA1 Message Date
Chris Thrasher
9a8ca3227f Add UBsan to CI 2023-10-27 16:36:38 -06:00
André Polomat
014366b84a Updated the test for the maximum antialiasing level of render texture
it returns 32 on my system, 64 should still be a reasonable value
2023-10-27 12:46:27 -06:00
Chris Thrasher
6aabb75bcf Fix sf::Image tests
Bitten by a copy pasta error. We can't test for exact pixel values
since jpeg compression changes pixel values slightly.
2023-10-21 12:44:51 -05:00
Chris Thrasher
1c037e1cba Add tests for sf::Image::saveToFile 2023-10-20 23:53:18 -05:00
Chris Thrasher
bb1a465e50 Add cppcoreguidelines-pro-type-member-init clang-tidy check
This marks another good step towards systematically rooting out
undefined behavior in the form of reading uninitialized memory.
2023-10-17 21:41:36 -05:00
Chris Thrasher
dbb87db026 Add more tests for sf::Text 2023-09-28 12:41:29 -06:00
Chris Thrasher
9dc2e541e8 Add clang-tidy modernize-return-braced-init-list check 2023-09-17 15:47:33 -06:00
Chris Thrasher
332d11be41 Add move semantics to sf::RenderTarget and sf::RenderTexture 2023-09-05 17:12:06 -06:00
Chris Thrasher
70f9d49559 Add tests for sf::Texture::generateMipmap 2023-09-05 10:58:14 -06:00
Chris Thrasher
d7ab9208be Add tests for sf::RenderTexture
The generateMipmap test was failing because I forgot to enable MESA
in the MinGW Static Standard Library job.
2023-09-05 10:58:14 -06:00
Chris Thrasher
0a3b0d1d16 Add tests for sf::RenderTarget 2023-09-05 10:58:14 -06:00
Chris Thrasher
62c376ffa5 Remove unnecessary parentheses 2023-08-21 09:07:32 -06:00
Chris Thrasher
bc86e0bced Add tests for sf::Sprite 2023-08-06 11:18:06 -06:00
Chris Thrasher
60dbed7e5e Add tests for sf::Text 2023-08-05 18:58:54 -06:00
kimci86
669d9f53bc Update Text constructor static assert to use correct parameters 2023-08-05 14:39:07 -06:00
Chris Thrasher
751aceadf8 Add tests for sf::Shader::loadFromFile
Plus a few cleanups while I was in there
2023-08-05 14:37:47 -06:00
Chris Thrasher
e17cab1fbf Add tests for sf::Texture::loadFromFile 2023-08-05 14:37:47 -06:00
Chris Thrasher
c9d9f84a0e Add tests for sf::Image::loadFromFile 2023-08-04 19:26:30 -06:00
Chris Thrasher
cb4cf4d090 Remove redundant type trait tests 2023-07-17 08:38:26 -06:00
Chris Thrasher
b9f56f79f0 Relax criteria for geometric center test
Required to satisfy slight differences in how icpx handles
floating point numbers. Only the x value of this vector required
a larger tolerance than normal. Given how many floating point
calculations are required to calculate geometric center, I'm not
surprised to see such a modest deviation.
2023-07-08 17:00:58 -06:00
Chris Thrasher
20f34d38fd Add tests for sf::Font 2023-07-07 13:21:56 -06:00
Chris Thrasher
53e2fab582 Prefer named colors 2023-05-25 17:08:42 -06:00
Chris Thrasher
d131beb0fd Fix misspellings
I used the Python tool codespell to find these
2023-05-21 14:37:46 -06:00
Ted Lyngmo
9855552f64 Add sf::Shape::getGeometricCenter()
This adds

    virtual Vector2f getGeometricCenter() const = 0;

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
2023-05-15 16:13:39 -06:00
Chris Thrasher
f6dfc04938 Switch to Catch2 2023-05-13 12:38:11 -06:00
Chris Thrasher
b14d0b47e6 Fix broken sf::swap overloads 2023-05-13 12:20:44 -06:00
Chris Thrasher
fb1cfdc48d Add misc-const-correctness clang-tidy check 2023-05-04 16:22:03 -06:00
vittorioromeo
cbfa9cbb65 Reorder includes hierarchically 2023-04-25 17:25:33 +02:00
Chris Thrasher
cafaa1c153 Add clang-tidy performance-* checks 2023-04-10 10:08:13 -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
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
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
cdf8ab38fb Add tests for sf::VertexBuffer 2023-02-13 11:47:53 -07:00
Jim-Marsden
976bbda911 Drawable Test 2023-01-24 16:27:11 -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
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
3b6db4d18c Enforce variable case 2022-12-12 16:10:03 -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
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
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
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
e2528de20a Replace sf::Uint8 with std::uint8_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
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
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
0812054e02 Remove trailing whitespace 2022-06-25 21:32:55 +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
2a5ce3c989 Apply compiler warnings to tests 2022-05-02 08:39:02 +02:00
Chris Thrasher
9010e7ba38 Add tests for sf::RectangleShape 2022-04-12 08:15:44 +02:00
Chris Thrasher
9cbd9c5976 Add tests for sf::Shape 2022-04-08 16:46:51 +02:00
Chris Thrasher
5c9b571c70 Add tests for sf::VertexArray 2022-03-16 09:56:29 +01:00
Chris Thrasher
abe420897d Add tests for sf::Transformable 2022-02-17 20:48:30 +00:00
Vittorio Romeo
dbeef66693 Turn 'sf::Transform' into a 'constexpr' class 2022-02-10 23:51:47 +00:00
Vittorio Romeo
0e419543f2 Make 'Color' constants 'constexpr' and add tests 2022-02-08 23:32:12 +00:00
Chris Thrasher
28f273b9c9 Add sf::Angle
Similar to sf::Time, sf::Angle provides a typesafe API for working
with angles and provides named functions for converting to and from
degrees and radians.
2022-02-08 22:52:37 +00:00
Chris Thrasher
7c80f302e4 Use std::optional to remove extra sf::Rect::intersects overload 2022-01-27 02:55:11 +00:00
Chris Thrasher
7cdb728e52 Add tests for sf::BlendMode 2022-01-20 07:39:19 +01:00
Chris Thrasher
b717a68fba Add tests for sf::Transform 2022-01-08 15:06:12 +01:00
Chris Thrasher
3d01efb80a Use operator<< for printing during test failure 2022-01-07 20:04:54 +01:00
Chris Thrasher
79c2aadbcc Remove redundant 4-param sf::Rect<T> constructor 2022-01-06 20:04:03 +01:00
Chris Thrasher
6c816aba44 Add tests for sf::Vertex 2022-01-06 20:02:09 +01:00
Vittorio Romeo
50d28e3879 Add tests for 'sf::Color' 2021-12-27 17:35:06 +01:00
Chris Thrasher
14fff20eb8 Remove redundant API taking x,y pair instead of sf::Vector 2021-12-26 17:13:18 +01:00
Vittorio Romeo
29983aa8d4 Replace Catch with Doctest 2021-12-24 15:06:32 +01:00
Chris Thrasher
ade9843dd8 Collapse test/src directory 2021-12-24 11:56:58 +01:00