Allow using alignment with wxEXPAND and wxSHAPED in wxBoxSizer
Don't assert in wxBoxSizer when both alignment flags and wxEXPAND are used together if wxSHAPED is also used, as such flag combinations may make sense and so shouldn't be forbidden. Add a unit test checking that this is allowed.
This commit is contained in:
@@ -398,6 +398,15 @@ TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::IncompatibleFlags", "[sizer]")
|
||||
ASSERT_SIZER_INCOMPATIBLE_FLAGS(wxEXPAND, wxALIGN_CENTRE_VERTICAL);
|
||||
ASSERT_SIZER_INCOMPATIBLE_FLAGS(wxEXPAND, wxALIGN_BOTTOM);
|
||||
|
||||
// But combining it with these flags and wxSHAPED does make sense and so
|
||||
// shouldn't result in an assert.
|
||||
CHECK_NOTHROW(
|
||||
sizer->Add(10, 10, 0, wxEXPAND | wxSHAPED | wxALIGN_CENTRE_VERTICAL)
|
||||
);
|
||||
CHECK_NOTHROW(
|
||||
sizer->Add(10, 10, 0, wxEXPAND | wxSHAPED | wxALIGN_TOP)
|
||||
);
|
||||
|
||||
|
||||
// And now exactly the same thing in the other direction.
|
||||
sizer = new wxBoxSizer(wxVERTICAL);
|
||||
@@ -419,6 +428,13 @@ TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::IncompatibleFlags", "[sizer]")
|
||||
ASSERT_SIZER_INCOMPATIBLE_FLAGS(wxEXPAND, wxALIGN_CENTRE_HORIZONTAL);
|
||||
ASSERT_SIZER_INCOMPATIBLE_FLAGS(wxEXPAND, wxALIGN_RIGHT);
|
||||
|
||||
CHECK_NOTHROW(
|
||||
sizer->Add(10, 10, 0, wxEXPAND | wxSHAPED | wxALIGN_CENTRE_HORIZONTAL)
|
||||
);
|
||||
CHECK_NOTHROW(
|
||||
sizer->Add(10, 10, 0, wxEXPAND | wxSHAPED | wxALIGN_RIGHT)
|
||||
);
|
||||
|
||||
#undef ASSERT_SIZER_INCOMPATIBLE_FLAGS
|
||||
#undef ASSERT_SIZER_INVALID_FLAGS
|
||||
}
|
||||
|
Reference in New Issue
Block a user