diff --git a/hyprtester/src/tests/main/animations.cpp b/hyprtester/src/tests/main/animations.cpp new file mode 100644 index 000000000..e464dcbd9 --- /dev/null +++ b/hyprtester/src/tests/main/animations.cpp @@ -0,0 +1,22 @@ +#include "../../Log.hpp" +#include "tests.hpp" +#include "../../shared.hpp" +#include "../../hyprctlCompat.hpp" +#include +#include + +static int ret = 0; + +using namespace Hyprutils::OS; +using namespace Hyprutils::Memory; + +static bool test() { + NLog::log("{}Testing animations", Colors::GREEN); + + auto str = getFromSocket("/animations"); + NLog::log("{}Testing bezier curve output from `hyprctl animations`", Colors::YELLOW); + {EXPECT_CONTAINS(str, std::format("beziers:\n\n\tname: quick\n\t\tX0: 0.15\n\t\tY0: 0.00\n\t\tX1: 0.10\n\t\tY1: 1.00"))}; + return !ret; +} + +REGISTER_TEST_FN(test) diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index eb908e1d1..cbc8c641c 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -786,7 +786,9 @@ static std::string animationsRequest(eHyprCtlOutputFormat format, std::string re ret += "beziers:\n"; for (auto const& bz : g_pAnimationManager->getAllBeziers()) { - ret += std::format("\n\tname: {}\n", bz.first); + auto& controlPoints = bz.second->getControlPoints(); + ret += std::format("\n\tname: {}\n\t\tX0: {:.2f}\n\t\tY0: {:.2f}\n\t\tX1: {:.2f}\n\t\tY1: {:.2f}", bz.first, controlPoints[1].x, controlPoints[1].y, controlPoints[2].x, + controlPoints[2].y); } } else { // json @@ -811,11 +813,16 @@ static std::string animationsRequest(eHyprCtlOutputFormat format, std::string re ret += ",\n["; for (auto const& bz : g_pAnimationManager->getAllBeziers()) { + auto& controlPoints = bz.second->getControlPoints(); ret += std::format(R"#( {{ - "name": "{}" + "name": "{}", + "X0": {:.2f}, + "Y0": {:.2f}, + "X1": {:.2f}, + "Y1": {:.2f} }},)#", - escapeJSONStrings(bz.first)); + escapeJSONStrings(bz.first), controlPoints[1].x, controlPoints[1].y, controlPoints[2].x, controlPoints[2].y); } trimTrailingComma(ret);