X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/232fdc630c42eb165f7659981043e794be03b3b7..c29c95fe24973b94fd724db767193171ca7c513d:/tests/controls/slidertest.cpp?ds=inline diff --git a/tests/controls/slidertest.cpp b/tests/controls/slidertest.cpp index 536166c8fc..4e3bc74442 100644 --- a/tests/controls/slidertest.cpp +++ b/tests/controls/slidertest.cpp @@ -39,6 +39,9 @@ private: CPPUNIT_TEST( Value ); CPPUNIT_TEST( Range ); WXUISIM_TEST( Thumb ); + CPPUNIT_TEST( PseudoTest_Inversed ); + CPPUNIT_TEST( Value ); + CPPUNIT_TEST( Range ); CPPUNIT_TEST_SUITE_END(); void PageUpDown(); @@ -47,21 +50,33 @@ private: void Value(); void Range(); void Thumb(); + void PseudoTest_Inversed() { ms_inversed = true; } + + static bool ms_inversed; wxSlider* m_slider; DECLARE_NO_COPY_CLASS(SliderTestCase) }; +bool SliderTestCase::ms_inversed = false; + // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( SliderTestCase ); -// also include in it's own registry so that these tests can be run alone +// also include in its own registry so that these tests can be run alone CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SliderTestCase, "SliderTestCase" ); void SliderTestCase::setUp() { - m_slider = new wxSlider(wxTheApp->GetTopWindow(), wxID_ANY, 50, 0, 100); + long style = wxSL_HORIZONTAL; + + if ( ms_inversed ) + style |= wxSL_INVERSE; + + m_slider = new wxSlider(wxTheApp->GetTopWindow(), wxID_ANY, 50, 0, 100, + wxDefaultPosition, wxDefaultSize, + style); } void SliderTestCase::tearDown() @@ -163,6 +178,11 @@ void SliderTestCase::Range() CPPUNIT_ASSERT_EQUAL(0, m_slider->GetMin()); CPPUNIT_ASSERT_EQUAL(100, m_slider->GetMax()); + // Changing range shouldn't change the value. + m_slider->SetValue(17); + m_slider->SetRange(0, 200); + CPPUNIT_ASSERT_EQUAL(17, m_slider->GetValue()); + //Test negative ranges m_slider->SetRange(-50, 0);