Replace a single function with a class in Enter processing tests

No real changes yet, this is a pure refactoring before the upcoming
changes.
This commit is contained in:
Vadim Zeitlin
2019-09-08 18:47:13 +02:00
parent ba2ea837de
commit e85b5e5261
4 changed files with 44 additions and 18 deletions

View File

@@ -75,11 +75,27 @@ private:
wxDECLARE_NO_COPY_CLASS(TextEntryTestCase);
};
// Function to call to test that wxTE_PROCESS_ENTER is handled correctly for
// the controls of the type created by the given creator function when they're
// placed in a dialog with a default button.
typedef wxControl* (*TextLikeControlCreator)(wxWindow* parent, int style);
// Helper used for creating the control of the specific type (currently either
// wxTextCtrl or wxComboBox) with the given flag.
class TextLikeControlCreator
{
public:
TextLikeControlCreator() {}
void TestProcessEnter(TextLikeControlCreator controlCreator);
// Create the control of the right type using the given parent and style.
virtual wxControl* Create(wxWindow* parent, int style) const = 0;
// Give it a virtual dtor to avoid warnings even though this class is not
// supposed to be used polymorphically.
virtual ~TextLikeControlCreator() {}
private:
wxDECLARE_NO_COPY_CLASS(TextLikeControlCreator);
};
// Use the given control creator to check that various combinations of
// specifying and not specifying wxTE_PROCESS_ENTER and handling or not
// handling the resulting event work as expected.
void TestProcessEnter(const TextLikeControlCreator& controlCreator);
#endif // _WX_TESTS_CONTROLS_TEXTENTRYTEST_H_