LEL is able to position right/left/top/bottom and expand out too.
This commit is contained in:
parent
872cedc8e1
commit
cebf61a794
4 changed files with 27 additions and 18 deletions
|
@ -11,20 +11,20 @@ TEST_CASE("test basic ops", "[lel]") {
|
|||
LELParser parser(0, 0, 500, 500);
|
||||
std::vector<std::string> labels{
|
||||
"label_1", "label3", "text1", "people",
|
||||
"label2", "_", "message", "buttons"};
|
||||
"label2", "message", "buttons"};
|
||||
|
||||
bool good = parser.parse(
|
||||
"[ label_1 | label3 | test1]"
|
||||
"[ *(300,300)text1 | (150)people | test2]"
|
||||
"[ >label2 | _ | test3]"
|
||||
"[ *(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.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);
|
||||
|
@ -34,8 +34,8 @@ TEST_CASE("test basic ops", "[lel]") {
|
|||
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);
|
||||
fmt::println("name={}; col/row={},{}; x/y={},{} w/h={},{}; right={}, bottom={}, expand={}",
|
||||
name, cell.col, cell.row, cell.x, cell.y, cell.w, cell.h, cell.right, cell.bottom, cell.expand);
|
||||
|
||||
REQUIRE(cell.w > 0);
|
||||
REQUIRE(cell.h > 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue