Fix testing wxSpinCtrl[Double] unsupported features under wxQt

Backwards ranges are not supported under wxQt and setting empty string
in the control automatically displays minVal.
This commit is contained in:
ali kettab 2023-10-03 21:08:18 +01:00
parent ff4995ec01
commit 7e360dcf1e
3 changed files with 24 additions and 0 deletions

View file

@ -136,6 +136,10 @@ public:
/**
Returns the text in the text entry part of the control.
@note In wxQt, setting an empty string in the control is exactly the same
as calling SetValue(GetMin()). So this function always returns a non-empty
string under this platform.
@since 3.1.6
*/
wxString GetTextValue() const;
@ -189,6 +193,8 @@ public:
@note Setting a range including negative values is silently ignored
if current base is set to 16.
@note In wxQt @a minVal must be less than @a maxVal.
*/
void SetRange(int minVal, int maxVal);
@ -362,6 +368,10 @@ public:
/**
Returns the text in the text entry part of the control.
@note In wxQt, setting an empty string in the control is exactly the same
as calling SetValue(GetMin()). So this function always returns a non-empty
string under this platform.
@since 3.1.6
*/
wxString GetTextValue() const;
@ -393,6 +403,8 @@ public:
/**
Sets range of allowable values.
@note In wxQt @a minVal must be less than @a maxVal.
*/
void SetRange(double minVal, double maxVal);

View file

@ -143,11 +143,13 @@ TEST_CASE_METHOD(SpinCtrlDoubleTestCase,
CHECK( m_spin->GetMin() == -10.0 );
CHECK( m_spin->GetMax() == 10.0 );
#ifndef __WXQT__
//Test backwards ranges
m_spin->SetRange(75.0, 50.0);
CHECK( m_spin->GetMin() == 75.0 );
CHECK( m_spin->GetMax() == 50.0 );
#endif
}
TEST_CASE_METHOD(SpinCtrlDoubleTestCase,
@ -182,7 +184,11 @@ TEST_CASE_METHOD(SpinCtrlDoubleTestCase,
CHECK( updatedText.GetCount() == 0 );
m_spin->SetValue("");
#ifndef __WXQT__
CHECK( m_spin->GetTextValue() == "" );
#else
CHECK( m_spin->GetTextValue() == "0.00" ); // the control automatically displays minVal
#endif
CHECK( m_spin->GetValue() == 0 );
CHECK( updatedSpin.GetCount() == 0 );

View file

@ -253,11 +253,13 @@ TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Range", "[spinctrl]")
CHECK(m_spin->GetBase() == 10);
#ifndef __WXQT__
//Test backwards ranges
m_spin->SetRange(75, 50);
CHECK(m_spin->GetMin() == 75);
CHECK(m_spin->GetMax() == 50);
#endif
}
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Value", "[spinctrl]")
@ -291,7 +293,11 @@ TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Value", "[spinctrl]")
CHECK(updatedText.GetCount() == 0);
m_spin->SetValue("");
#ifndef __WXQT__
CHECK( m_spin->GetTextValue() == "" );
#else
CHECK( m_spin->GetTextValue() == "0" ); // the control automatically displays minVal
#endif
CHECK( m_spin->GetValue() == 0 );
CHECK(updatedSpin.GetCount() == 0);