Draw tests should use a valid mouse position, even if position isn't checked

0.8
Bruno Van de Velde 2017-09-28 16:13:02 +02:00
parent 86fd9dffbd
commit dd19e78a4a
4 changed files with 24 additions and 16 deletions

View File

@ -333,6 +333,8 @@ TEST_CASE("[Button]")
renderer.setTextureDisabled("resources/Texture4.png");
};
const auto mousePos = button->getPosition() + (button->getSize() / 2.f);
SECTION("Colored")
{
SECTION("NormalState")
@ -354,7 +356,7 @@ TEST_CASE("[Button]")
SECTION("HoverState")
{
button->mouseMoved({0,0});
button->mouseMoved(mousePos);
TEST_DRAW("Button_Hover_NormalSet.png")
@ -373,8 +375,8 @@ TEST_CASE("[Button]")
SECTION("DownState")
{
button->mouseMoved({0,0});
button->leftMousePressed({0,0});
button->mouseMoved(mousePos);
button->leftMousePressed(mousePos);
TEST_DRAW("Button_Down_NormalSet.png")
@ -428,7 +430,7 @@ TEST_CASE("[Button]")
SECTION("HoverState")
{
button->mouseMoved({0,0});
button->mouseMoved(mousePos);
TEST_DRAW("Button_Hover_TextureNormalSet.png")
@ -447,8 +449,8 @@ TEST_CASE("[Button]")
SECTION("DownState")
{
button->mouseMoved({0,0});
button->leftMousePressed({0,0});
button->mouseMoved(mousePos);
button->leftMousePressed(mousePos);
TEST_DRAW("Button_Down_TextureNormalSet.png")

View File

@ -297,6 +297,8 @@ TEST_CASE("[CheckBox]")
renderer.setTextureCheckedDisabled("resources/Texture6.png");
};
const auto mousePos = checkBox->getPosition() + (checkBox->getSize() / 2.f);
SECTION("Colored")
{
SECTION("NormalState")
@ -325,7 +327,7 @@ TEST_CASE("[CheckBox]")
SECTION("HoverState")
{
checkBox->mouseMoved({0,0});
checkBox->mouseMoved(mousePos);
TEST_DRAW("CheckBox_Hover_NormalSet.png")
@ -339,7 +341,7 @@ TEST_CASE("[CheckBox]")
SECTION("CheckedHoverState")
{
checkBox->check();
checkBox->mouseMoved({0,0});
checkBox->mouseMoved(mousePos);
TEST_DRAW("CheckBox_CheckedHover_NormalSet.png")
@ -409,7 +411,7 @@ TEST_CASE("[CheckBox]")
SECTION("HoverState")
{
checkBox->mouseMoved({0,0});
checkBox->mouseMoved(mousePos);
TEST_DRAW("CheckBox_Hover_TextureNormalSet.png")
@ -423,7 +425,7 @@ TEST_CASE("[CheckBox]")
SECTION("CheckedHoverState")
{
checkBox->check();
checkBox->mouseMoved({0,0});
checkBox->mouseMoved(mousePos);
TEST_DRAW("CheckBox_CheckedHover_TextureNormalSet.png")

View File

@ -617,6 +617,8 @@ TEST_CASE("[EditBox]")
renderer.setTextureDisabled("resources/Texture3.png");
};
const auto mousePos = editBox->getPosition() + (editBox->getSize() / 2.f);
editBox->selectText(2, 3);
editBox->focus();
@ -635,7 +637,7 @@ TEST_CASE("[EditBox]")
SECTION("HoverState")
{
editBox->mouseMoved({0,0});
editBox->mouseMoved(mousePos);
TEST_DRAW("EditBox_Hover_NormalSet.png")
@ -677,7 +679,7 @@ TEST_CASE("[EditBox]")
SECTION("HoverState")
{
editBox->mouseMoved({0,0});
editBox->mouseMoved(mousePos);
TEST_DRAW("EditBox_Hover_TextureNormalSet.png")

View File

@ -473,6 +473,8 @@ TEST_CASE("[RadioButton]")
renderer.setTextureCheckedDisabled("resources/Texture6.png");
};
const auto mousePos = radioButton->getPosition() + (radioButton->getSize() / 2.f);
SECTION("Colored")
{
renderer.setBorders({2});
@ -503,7 +505,7 @@ TEST_CASE("[RadioButton]")
SECTION("HoverState")
{
radioButton->mouseMoved({0,0});
radioButton->mouseMoved(mousePos);
TEST_DRAW("RadioButton_Hover_NormalSet.png")
@ -517,7 +519,7 @@ TEST_CASE("[RadioButton]")
SECTION("CheckedHoverState")
{
radioButton->check();
radioButton->mouseMoved({0,0});
radioButton->mouseMoved(mousePos);
TEST_DRAW("RadioButton_CheckedHover_NormalSet.png")
@ -587,7 +589,7 @@ TEST_CASE("[RadioButton]")
SECTION("HoverState")
{
radioButton->mouseMoved({0,0});
radioButton->mouseMoved(mousePos);
TEST_DRAW("RadioButton_Hover_TextureNormalSet.png")
@ -601,7 +603,7 @@ TEST_CASE("[RadioButton]")
SECTION("CheckedHoverState")
{
radioButton->check();
radioButton->mouseMoved({0,0});
radioButton->mouseMoved(mousePos);
TEST_DRAW("RadioButton_CheckedHover_TextureNormalSet.png")