Fix generation of extraneous wxEVT_SLIDER events in wxMSW

Don't send the event when it's redundant, i.e. doesn't really notify
about the change in the slider value.

Also add a test case for wxEVT_SLIDER and show these events in the
widgets sample.

Closes https://github.com/wxWidgets/wxWidgets/pull/2080

Closes #18929.
This commit is contained in:
PB
2020-10-07 18:18:55 +02:00
committed by Vadim Zeitlin
parent 7ed330a197
commit 952e5f32cd
3 changed files with 48 additions and 5 deletions

View File

@@ -35,6 +35,7 @@ private:
#ifndef __WXOSX__
WXUISIM_TEST( PageUpDown );
WXUISIM_TEST( LineUpDown );
WXUISIM_TEST( EvtSlider );
WXUISIM_TEST( LinePageSize );
#endif
CPPUNIT_TEST( Value );
@@ -47,6 +48,7 @@ private:
void PageUpDown();
void LineUpDown();
void EvtSlider();
void LinePageSize();
void Value();
void Range();
@@ -125,6 +127,24 @@ void SliderTestCase::LineUpDown()
#endif
}
void SliderTestCase::EvtSlider()
{
#if wxUSE_UIACTIONSIMULATOR
EventCounter slider(m_slider, wxEVT_SLIDER);
wxUIActionSimulator sim;
wxYield();
m_slider->SetFocus();
sim.Char(WXK_UP);
sim.Char(WXK_DOWN);
wxYield();
CPPUNIT_ASSERT_EQUAL(2, slider.GetCount());
#endif
}
void SliderTestCase::LinePageSize()
{
#if wxUSE_UIACTIONSIMULATOR