Fix even more warnings about combining different enums in C++20
This completes the changes of5477d4faa8(Avoid warnings when combining wxStaticText styles with C++20, 2022-07-20) which, in turn, was based on3d278ee75f(Avoid warnings about operations on different enums in C++20 mode, 2021-04-25). Also add a test checking that no warnings are given for all possible enum values combinations (but this test is only useful when using C++20). See #22681.
This commit is contained in:
parent
667c5c843b
commit
8a5d9295b7
2 changed files with 47 additions and 2 deletions
|
|
@ -447,3 +447,39 @@ TEST_CASE_METHOD(BoxSizerTestCase, "BoxSizer::Replace", "[sizer]")
|
|||
m_sizer->AddSpacer(1);
|
||||
m_sizer->Replace(0, new wxSizerItem(new wxWindow(m_win, wxID_ANY)));
|
||||
}
|
||||
|
||||
TEST_CASE("Sizer::CombineFlags", "[sizer]")
|
||||
{
|
||||
// This is a compile-time test which simply verifies that we can combine
|
||||
// all the different flags without getting any warnings about doing it --
|
||||
// as would have been the case when using C++20 or later if we didn't use
|
||||
// wxALLOW_COMBINING_ENUMS() for all these enums in wx/defs.h.
|
||||
//
|
||||
// These constants belong to the following enums, respectively:
|
||||
//
|
||||
// wxALIGN_CENTER wxAlignment
|
||||
// wxBORDER_NONE wxBorder
|
||||
// wxLEFT wxDirection
|
||||
// wxCENTER wxGeometryCentre
|
||||
// wxFIXED_MINSIZE wxSizerFlagBits
|
||||
// wxEXPAND wxStretch
|
||||
//
|
||||
int n = (wxALIGN_CENTER | wxBORDER_NONE)
|
||||
| (wxALIGN_CENTER | wxLEFT)
|
||||
| (wxALIGN_CENTER | wxCENTER)
|
||||
| (wxALIGN_CENTER | wxFIXED_MINSIZE)
|
||||
| (wxALIGN_CENTER | wxEXPAND)
|
||||
| (wxBORDER_NONE | wxLEFT)
|
||||
| (wxBORDER_NONE | wxCENTER)
|
||||
| (wxBORDER_NONE | wxFIXED_MINSIZE)
|
||||
| (wxBORDER_NONE | wxEXPAND)
|
||||
| (wxLEFT | wxCENTER)
|
||||
| (wxLEFT | wxFIXED_MINSIZE)
|
||||
| (wxLEFT | wxEXPAND)
|
||||
| (wxCENTER | wxFIXED_MINSIZE)
|
||||
| (wxCENTER | wxEXPAND)
|
||||
| (wxFIXED_MINSIZE | wxEXPAND)
|
||||
;
|
||||
|
||||
wxUnusedVar(n);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue