|
|
|
@ -18,9 +18,18 @@ TEST_CASE("test basic ops", "[lel]") { |
|
|
|
|
|
|
|
|
|
REQUIRE(good); |
|
|
|
|
|
|
|
|
|
REQUIRE(parser.rows == 4); |
|
|
|
|
REQUIRE(parser.columns == 3); |
|
|
|
|
REQUIRE(parser.cells.size() == 11); |
|
|
|
|
for(size_t rowcount = 0; rowcount < parser.grid.size(); rowcount++) { |
|
|
|
|
auto& row = parser.grid[rowcount]; |
|
|
|
|
|
|
|
|
|
for(size_t colcount = 0; colcount < row.size(); colcount++) { |
|
|
|
|
auto &name = row[colcount]; |
|
|
|
|
auto &cell = parser.cells.at(name); |
|
|
|
|
REQUIRE(cell.row == int(rowcount)); |
|
|
|
|
REQUIRE(cell.col == int(colcount)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
REQUIRE(parser.cells.size() == 12); |
|
|
|
|
REQUIRE(parser.cells.at("label2").right == true); |
|
|
|
|
REQUIRE(parser.cells.at("text1").expand == true); |
|
|
|
|
REQUIRE(parser.cells.at("text1").w == 300); |
|
|
|
@ -32,12 +41,10 @@ TEST_CASE("test basic ops", "[lel]") { |
|
|
|
|
for(auto& [name, cell] : parser.cells) { |
|
|
|
|
REQUIRE(cell.w > 0); |
|
|
|
|
REQUIRE(cell.h > 0); |
|
|
|
|
REQUIRE(cell.row < parser.rows); |
|
|
|
|
REQUIRE(cell.col < parser.columns); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
auto hit = parser.hit(250, 250); |
|
|
|
|
REQUIRE(*hit == "people"); |
|
|
|
|
auto hit = parser.hit(10, 10); |
|
|
|
|
REQUIRE(*hit == "label_1"); |
|
|
|
|
|
|
|
|
|
auto nohit = parser.hit(1000, 1000); |
|
|
|
|
REQUIRE(!nohit); |
|
|
|
|