mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-25 17:21:54 -07:00
This commit is contained in:
22
hyprtester/src/tests/main/animations.cpp
Normal file
22
hyprtester/src/tests/main/animations.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "../../Log.hpp"
|
||||
#include "tests.hpp"
|
||||
#include "../../shared.hpp"
|
||||
#include "../../hyprctlCompat.hpp"
|
||||
#include <hyprutils/os/Process.hpp>
|
||||
#include <hyprutils/memory/WeakPtr.hpp>
|
||||
|
||||
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)
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user