summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/layout_custom.cpp
blob: 9a98a74a2faec45648acb91d107e1c9363a159dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
    }
}