From 2256dac3841dd41fdd87232494aecc3429db2bde Mon Sep 17 00:00:00 2001 From: ali kettab Date: Thu, 23 Jul 2020 16:07:08 +0100 Subject: [PATCH] Enable wxSlider "Thumb" unit test under GTK too This was disabled, but only didn't work because wxSlider used tiny size in wxGTK by default previously. After correcting this in aa2d159e8c (Use more reasonable length for wxSlider in wxGTK by default, 2020-08-04), the unit test passes with wxGTK too and can be reenabled. Closes https://github.com/wxWidgets/wxWidgets/pull/1992 --- tests/controls/slidertest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/controls/slidertest.cpp b/tests/controls/slidertest.cpp index e09b20f3b0..9ecc97327c 100644 --- a/tests/controls/slidertest.cpp +++ b/tests/controls/slidertest.cpp @@ -188,7 +188,7 @@ void SliderTestCase::Range() void SliderTestCase::Thumb() { -#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__) +#if wxUSE_UIACTIONSIMULATOR EventCounter track(m_slider, wxEVT_SCROLL_THUMBTRACK); EventCounter release(m_slider, wxEVT_SCROLL_THUMBRELEASE); EventCounter changed(m_slider, wxEVT_SCROLL_CHANGED); @@ -197,12 +197,14 @@ void SliderTestCase::Thumb() m_slider->SetValue(0); - sim.MouseDragDrop(m_slider->ClientToScreen(wxPoint(10, 10)),m_slider->ClientToScreen(wxPoint(50, 10))); + // use the slider real position for dragging the mouse. + const int ypos = m_slider->GetSize().y / 2; + sim.MouseDragDrop(m_slider->ClientToScreen(wxPoint(10, ypos)),m_slider->ClientToScreen(wxPoint(50, ypos))); wxYield(); CPPUNIT_ASSERT(track.GetCount() != 0); CPPUNIT_ASSERT_EQUAL(1, release.GetCount()); -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXGTK__) CPPUNIT_ASSERT_EQUAL(1, changed.GetCount()); #endif #endif