mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 05:38:11 +02:00
tests
This commit is contained in:
parent
16cb079057
commit
f66dcf2cd7
2 changed files with 85 additions and 0 deletions
56
hyprtester/src/tests/main/layout_custom.cpp
Normal file
56
hyprtester/src/tests/main/layout_custom.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#include "../shared.hpp"
|
||||
#include "../../shared.hpp"
|
||||
#include "../../hyprctlCompat.hpp"
|
||||
#include "tests.hpp"
|
||||
|
||||
TEST_CASE(layoutCustomGrid) {
|
||||
OK(getFromSocket("r/eval hl.config({ general = { layout = 'lua:grid' } })"));
|
||||
|
||||
ASSERT(!!Tests::spawnKitty("kitty_A"), true);
|
||||
ASSERT(!!Tests::spawnKitty("kitty_B"), true);
|
||||
|
||||
{
|
||||
auto clients = getFromSocket("/clients");
|
||||
EXPECT_COUNT_STRING(clients, "size: 931,1036", 2);
|
||||
}
|
||||
|
||||
ASSERT(!!Tests::spawnKitty("kitty_C"), true);
|
||||
|
||||
{
|
||||
auto clients = getFromSocket("/clients");
|
||||
EXPECT_COUNT_STRING(clients, "size: 931,511", 3);
|
||||
}
|
||||
|
||||
ASSERT(!!Tests::spawnKitty("kitty_D"), true);
|
||||
|
||||
{
|
||||
auto clients = getFromSocket("/clients");
|
||||
EXPECT_COUNT_STRING(clients, "size: 931,511", 4);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(layoutCustomColumns) {
|
||||
OK(getFromSocket("r/eval hl.config({ general = { layout = 'lua:columns' } })"));
|
||||
|
||||
ASSERT(!!Tests::spawnKitty("kitty_A"), true);
|
||||
ASSERT(!!Tests::spawnKitty("kitty_B"), true);
|
||||
|
||||
{
|
||||
auto clients = getFromSocket("/clients");
|
||||
EXPECT_COUNT_STRING(clients, "size: 931,1036", 2);
|
||||
}
|
||||
|
||||
ASSERT(!!Tests::spawnKitty("kitty_C"), true);
|
||||
|
||||
{
|
||||
auto clients = getFromSocket("/clients");
|
||||
EXPECT_COUNT_STRING(clients, ",1036\n", 3); // this won't split evenly
|
||||
}
|
||||
|
||||
ASSERT(!!Tests::spawnKitty("kitty_D"), true);
|
||||
|
||||
{
|
||||
auto clients = getFromSocket("/clients");
|
||||
EXPECT_COUNT_STRING(clients, ",1036\n", 4); // this won't split evenly
|
||||
}
|
||||
}
|
||||
|
|
@ -293,3 +293,32 @@ hl.gesture({ fingers = 4, direction = "left", action = function() hl.dispatch(hl
|
|||
hl.gesture({ fingers = 2, direction = "pinch", action = "cursorZoom", zoom_level = "1", mode = "live" })
|
||||
|
||||
hl.gesture({ fingers = 2, direction = "right", action = "float", disable_inhibit = true })
|
||||
|
||||
hl.layout.register("columns", {
|
||||
recalculate = function(ctx)
|
||||
local n = #ctx.targets
|
||||
if n == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
for i, target in ipairs(ctx.targets) do
|
||||
target:place(ctx:column(i, n))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
hl.layout.register("grid", {
|
||||
recalculate = function(ctx)
|
||||
local n = #ctx.targets
|
||||
if n == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local cols = math.ceil(math.sqrt(n))
|
||||
|
||||
for i, target in ipairs(ctx.targets) do
|
||||
target:place(ctx:grid_cell(i, cols))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue