#include "lel.hpp" #include #include #include #include "ansi_parser.hpp" #include #include #include TEST_CASE("test basic ops", "[lel]") { LELParser parser(0, 0, 500, 500); std::vector labels{ "label_1", "label3", "text1", "people", "label2", "_", "message", "buttons"}; 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() == 12); REQUIRE(parser.cells.at("label2").left == false); 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); for(auto name : labels) { auto& cell = parser.cells.at(name); fmt::println("name={}; col/row={},{}; x/y={},{} w/h={},{}; left={}, top={}, expand={}", name, cell.col, cell.row, cell.x, cell.y, cell.w, cell.h, cell.left, cell.top, cell.expand); REQUIRE(cell.w > 0); REQUIRE(cell.h > 0); REQUIRE(cell.row < parser.rows); REQUIRE(cell.col < parser.columns); } }