|
|
|
#include "lel.hpp"
|
|
|
|
#include <catch2/catch_test_macros.hpp>
|
|
|
|
#include <fmt/core.h>
|
|
|
|
#include <string>
|
|
|
|
#include "ansi_parser.hpp"
|
|
|
|
#include <codecvt>
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
TEST_CASE("test basic ops", "[lel]") {
|
|
|
|
lel::Parser parser(0, 0, 500, 500);
|
|
|
|
|
|
|
|
bool good = parser.parse(
|
|
|
|
"[ label_1 | label3 | test1]"
|
|
|
|
"[ *(300,300)text1 | (150)people | ^test2]"
|
|
|
|
"[ >label2 | _ | .test3]"
|
|
|
|
"[ =message | buttons | test4]");
|
|
|
|
|
|
|
|
REQUIRE(good);
|
|
|
|
|
|
|
|
REQUIRE(parser.rows == 4);
|
|
|
|
REQUIRE(parser.columns == 3);
|
|
|
|
REQUIRE(parser.cells.size() == 11);
|
|
|
|
REQUIRE(parser.cells.at("label2").right == true);
|
|
|
|
REQUIRE(parser.cells.at("text1").expand == true);
|
|
|
|
REQUIRE(parser.cells.at("text1").w == 300);
|
|
|
|
REQUIRE(parser.cells.at("text1").h == 300);
|
|
|
|
REQUIRE(parser.cells.at("people").expand == false);
|
|
|
|
REQUIRE(parser.cells.at("message").expand == false);
|
|
|
|
REQUIRE(parser.cells.at("message").center == true);
|
|
|
|
|
|
|
|
for(auto& [name, cell] : parser.cells) {
|
|
|
|
REQUIRE(cell.w > 0);
|
|
|
|
REQUIRE(cell.h > 0);
|
|
|
|
REQUIRE(cell.row < parser.rows);
|
|
|
|
REQUIRE(cell.col < parser.columns);
|
|
|
|
}
|
|
|
|
}
|