Don't decrease the number of digits implicitly
wxSpinCtrlDouble::SetIncrement() should increase the number of digits if necessary because not doing it would be inconsistent with the initial determination of the number of digits in the ctor and would actually lose the digits displayed, but it seems unnecessary to decrease the number of digits and it might be surprising, so don't do it. Add a test for this behaviour and document it.
This commit is contained in:
@@ -231,6 +231,11 @@ TEST_CASE_METHOD(SpinCtrlDoubleTestCase,
|
||||
CHECK( m_spin->GetDigits() == 5 );
|
||||
m_spin->SetValue(1.23456789);
|
||||
CHECK( m_spin->GetTextValue() == "1.23457" );
|
||||
|
||||
// The number of digits shouldn't (implicitly) decrease however.
|
||||
m_spin->SetIncrement(0.001);
|
||||
m_spin->SetValue(1.23456789);
|
||||
CHECK( m_spin->GetTextValue() == "1.23457" );
|
||||
}
|
||||
|
||||
static inline unsigned int GetInitialDigits(double inc)
|
||||
|
||||
Reference in New Issue
Block a user