Files
rive-cpp/tests/include/rive_testing.hpp
luigi-rosso a1441bba0a chore: fix clang-17 compiler (#9666) 8a1f3286b9
* chore: fix clang-17 compiler

* chore: adding missing file

* fix: rive_native builds

* chore: remove no runtime linking on linux

* chore: more fixes

* chore: removing rive_common

* chore: use build_rive.sh for ios

* chore: use rive_build.sh for recorder

* chore: fix fill missing version

* chore: add rive_build.sh to path

* chore: add rive_build.sh to pr_ios_tests.yaml

* chore: add rive_build to the recorder tests

* chore: drop rive_flutter tests

* chore: fixing ios tests

* fix misspelled

* chore: cleanup

* chore: use latest zlib

* chore: premake5.lua redirects to premake5_v2

* fix: tvos and ios builds

* fix: unreal build path for miniaudio

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2025-05-15 18:21:04 +00:00

55 lines
1.6 KiB
C++

#ifndef _CATCH_RIVE_TESTING_
#define _CATCH_RIVE_TESTING_
#include <catch.hpp>
#include <sstream>
#include "rive/math/mat2d.hpp"
#include "rive/text/cursor.hpp"
bool aboutEqual(const rive::Mat2D& a, const rive::Mat2D& b);
// StringMaker doesn't work for Vec2D.
#define CHECK_VEC2D(a, b) \
CHECK(a.x == b.x); \
CHECK(a.y == b.y);
#define CHECK_AABB(a, b) \
CHECK_VEC2D(a.min(), b.min()); \
CHECK_VEC2D(a.max(), b.max());
namespace Catch
{
template <> struct StringMaker<rive::Mat2D>
{
static std::string convert(rive::Mat2D const& value)
{
std::ostringstream os;
os << value[0] << ", " << value[1] << ", " << value[2] << ", "
<< value[3] << ", " << value[4] << ", " << value[5];
return os.str();
}
};
template <> struct StringMaker<rive::AABB>
{
static std::string convert(rive::AABB const& value)
{
std::ostringstream os;
os << "min: " << value.minX << ", " << value.minY
<< " max: " << value.maxX << ", " << value.maxY;
return os.str();
}
};
#ifdef WITH_RIVE_TEXT
template <> struct StringMaker<rive::CursorPosition>
{
static std::string convert(rive::CursorPosition const& value)
{
std::ostringstream os;
os << "Line: " << value.lineIndex()
<< ", CodePointIndex: " << value.codePointIndex();
return os.str();
}
};
#endif
} // namespace Catch
#endif