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>
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.
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.
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.
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.
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 <>.
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.
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.
This has been a recurring problem. I had to add similar code to the
sf::Angle operator<< because I was getting tiny floating point
differences that after rounding were imperceptable.
Transformable.cpp was originally compiled when I first submitted
PR #1973. While that PR was in review, #2012 got merged which
changed how tests are compiled. These two PR were in conflict so
when I went to resolve conflicts on #1973, I accidentaly removed
the line which added Transformable.cpp to the build. Because not
compiling this file caused no build breaks, nobody noticed until
after #1973 got merged. My bad, everybody.
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.
This is left over from 0f83e3d but we forgot to remove it. Nothing
about this file requires an elevated minimum CMake version now that
the FetchContent usage is gone.
This removes the sfml- prefixed targets from the export set. The sfml-
prefixed targets are still available within the build tree but not to
downstream users thus making this an API breaking change when compared
to the 2.x releases. To keep things consistent, usage of the sfml-
targets were replaced with their namespaced counterparts.
This has a number of benefits:
1. It's more idiomatic. Modern CMake libraries are expected to
have namespaced targets.
2. Namespaced targets are less likely to collide with user-defined
targets. No one will accidentally define a SFML:: target.
3. If a namespaced target is not found by CMake, configuration
will immediately stop.
The key benefit here is that now we're linking against their CMake
target which makes it easy to change how we depend on Catch2. We
can switch from FetchContent to FindPackage to a git submodule and
never have to change our code because we're depending on Catch2 in
the most flexible way possible.
Because Catch is so expensive to compile, it's really helpful for
initial compile times if this target doesn't have to be recompiled
so often. This won't make a huge impact on developers who are mostly
doing incremental builds but can have a meaningful impact on CI
runners that are always doing clean builds.
Provides a Catch::toString() overload for the following SFML classes, that support at least operator== and operator!=, and can thus be used in Catch assertion expressions:
* String
* Time
* Vector2<T>
* Vector3<T>
* VideoMode
* Color
* Rect<T>
The intermediate header UnitTests.hpp is introduced to ensure string conversion visibility.
Do not include <catch.hpp> directly any longer.