mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-03 00:59:47 +02:00
Menu test variation
This commit is contained in:
parent
bad113588c
commit
1cf006958f
@ -29,4 +29,30 @@ BOOST_AUTO_TEST_CASE(menu_test_click)
|
||||
BOOST_CHECK( clickered );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(menu_test_click_offset)
|
||||
{
|
||||
bool clickered = false;
|
||||
sf::Font f;
|
||||
Menu test(f);
|
||||
test.offset = sf::Vector2f(200.f, 200.f);
|
||||
test.addEntry(Menu::lambda("Test", [&]{ clickered = true; }));
|
||||
|
||||
BOOST_CHECK(! clickered );
|
||||
|
||||
// Click underneath the menu item.
|
||||
test.click(201.f, -1.f);
|
||||
|
||||
BOOST_CHECK(! clickered );
|
||||
|
||||
float h = test.entries.at(0)->getHeight();
|
||||
|
||||
test.click(201.f, 200.f + h + 1.f);
|
||||
|
||||
BOOST_CHECK(! clickered );
|
||||
|
||||
test.click(201.f, 200.f + h / 2.f);
|
||||
|
||||
BOOST_CHECK( clickered );
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user