Rename and simplify wxGridBlockCoords::ContainsBlock()

Change the return type of this function to a simple and clear bool
instead of 3-valued int requiring a special explanation. This is simpler
and not any less efficient as checking for whether one block contains
another or the other one contains this one are separate operations
anyhow.

Rename the function to a more grammatically correct name.

Also move it inline as it's now trivial enough for this to be worth it.
This commit is contained in:
Vadim Zeitlin
2020-04-05 01:37:56 +02:00
parent a5952ee087
commit 791a9e68ae
5 changed files with 23 additions and 42 deletions

View File

@@ -1337,17 +1337,19 @@ TEST_CASE("GridBlockCoords::ContainsCell", "[grid]")
CHECK(!wxGridBlockCoords(1, 1, 3, 3).ContainsCell(wxGridCellCoords(5, 5)));
}
TEST_CASE("GridBlockCoords::ContainBlock", "[grid]")
TEST_CASE("GridBlockCoords::ContainsBlock", "[grid]")
{
wxGridBlockCoords block1(1, 1, 5, 5);
wxGridBlockCoords block2(1, 1, 3, 3);
wxGridBlockCoords block3(2, 2, 7, 7);
wxGridBlockCoords block4(10, 10, 12, 12);
CHECK(block1.ContainBlock(block2) == 1);
CHECK(block2.ContainBlock(block1) == -1);
CHECK(block1.ContainBlock(block3) == 0);
CHECK(block1.ContainBlock(block4) == 0);
CHECK( block1.ContainsBlock(block2));
CHECK(!block2.ContainsBlock(block1));
CHECK(!block1.ContainsBlock(block3));
CHECK(!block1.ContainsBlock(block4));
CHECK(!block3.ContainsBlock(block1));
CHECK(!block4.ContainsBlock(block1));
}
TEST_CASE("GridBlockCoords::Difference", "[grid]")