From edc553870f8315330e91c81a60ce3088cb3b59c0 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 18 May 2020 20:23:41 +0200 Subject: [PATCH] Fix displaying wxSpinCtrlDouble values with default precision For the sake of consistency with native wxGTK implementation, spin control value should be displayed with fixed precision. See #17085. --- include/wx/generic/spinctlg.h | 2 +- tests/controls/spinctrldbltest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index ff3c8ca2ed..a252dc0c14 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -420,7 +420,7 @@ private: void Init() { m_digits = 0; - m_format = wxS("%g"); + m_format = "%0.0f"; } wxString m_format; diff --git a/tests/controls/spinctrldbltest.cpp b/tests/controls/spinctrldbltest.cpp index 7416423881..5166f7a9c6 100644 --- a/tests/controls/spinctrldbltest.cpp +++ b/tests/controls/spinctrldbltest.cpp @@ -199,7 +199,7 @@ void SpinCtrlDoubleTestCase::Increment() #if wxUSE_UIACTIONSIMULATOR CPPUNIT_ASSERT_EQUAL(1.0, m_spin->GetIncrement()); - m_spin->SetDigits(1); // GTK would fail without this. + m_spin->SetDigits(1); m_spin->SetIncrement(0.1); CPPUNIT_ASSERT_EQUAL(0.1, m_spin->GetIncrement());