Files
wxWidgets/tests/controls/pickerbasetest.cpp
T
Vadim Zeitlin 3087ec1945 Convert the remaining GUI unit tests to use Catch directly
Get rid of CPPUNIT_TEST_SUITE() and the other CppUnit compatibility macros
in all the remaining GUI tests, including the ones sharing their tests via
a common base class: wxItemContainer, wxTextEntry, wxBookCtrlBase and
wxPickerBase tests are now defined using the new wxXXX_TESTS() macros
generating one Catch test case per test instead of being listed inside the
test suite of the derived class.

Replace WXUISIM_TEST() with a check for EnableUITests() at the beginning of
the test itself and remove this macro from testprec.h, adding the new
generic wxTEST_CASE_FOR_METHOD() helper used by all the macros above there.

Get rid of the pseudo tests: wxTextCtrl tests for the multi-line controls
now use a separate fixture deriving from the single-line one instead of
PseudoTestSwitchToMultiLineStyle() and the owner-drawn wxListBox tests use
GENERATE() instead of PseudoTest_OwnerDrawn().

No real changes.

Assisted-by: Claude Opus 5
2026-08-24 18:46:44 +02:00

73 lines
1.7 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: tests/controls/pickerbasetest.cpp
// Purpose: wxPickerBase unit test
// Author: Steven Lamerton
// Created: 2010-08-07
// Copyright: (c) 2010 Steven Lamerton
///////////////////////////////////////////////////////////////////////////////
#include "testprec.h"
#if wxUSE_COLOURPICKERCTRL || \
wxUSE_DIRPICKERCTRL || \
wxUSE_FILEPICKERCTRL || \
wxUSE_FONTPICKERCTRL
#include "wx/pickerbase.h"
#include "pickerbasetest.h"
void PickerBaseTestCase::Margin()
{
wxPickerBase* const base = GetBase();
CHECK(base->HasTextCtrl());
CHECK(base->GetInternalMargin() >= 0);
base->SetInternalMargin(15);
CHECK(base->GetInternalMargin() == 15);
}
void PickerBaseTestCase::Proportion()
{
wxPickerBase* const base = GetBase();
CHECK(base->HasTextCtrl());
base->SetPickerCtrlProportion(1);
base->SetTextCtrlProportion(1);
CHECK(base->GetPickerCtrlProportion() == 1);
CHECK(base->GetTextCtrlProportion() == 1);
}
void PickerBaseTestCase::Growable()
{
wxPickerBase* const base = GetBase();
CHECK(base->HasTextCtrl());
base->SetPickerCtrlGrowable();
base->SetTextCtrlGrowable();
CHECK(base->IsPickerCtrlGrowable());
CHECK(base->IsTextCtrlGrowable());
base->SetPickerCtrlGrowable(false);
base->SetTextCtrlGrowable(false);
CHECK(!base->IsPickerCtrlGrowable());
CHECK(!base->IsTextCtrlGrowable());
}
void PickerBaseTestCase::Controls()
{
wxPickerBase* const base = GetBase();
CHECK(base->HasTextCtrl());
CHECK(base->GetTextCtrl() != nullptr);
CHECK(base->GetPickerCtrl() != nullptr);
}
#endif