Assert if incompatible sizer flags are used.

We can't check for all the invalid combinations, but at least check for
wxALIGN_CENTER_HORIZONTAL+wxALIGN_RIGHT and wxALIGN_CENTER_VERTICAL+
wxALIGN_BOTTOM which never make sense and can be detected.
This commit is contained in:
Vadim Zeitlin
2015-03-25 01:49:57 +01:00
parent 66cfa40643
commit 636d08323f
2 changed files with 20 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ private:
CPPUNIT_TEST( BestSizeRespectsMaxSize );
CPPUNIT_TEST( RecalcSizesRespectsMaxSize1 );
CPPUNIT_TEST( RecalcSizesRespectsMaxSize2 );
CPPUNIT_TEST( IncompatibleFlags );
CPPUNIT_TEST_SUITE_END();
void Size1();
@@ -52,6 +53,7 @@ private:
void BestSizeRespectsMaxSize();
void RecalcSizesRespectsMaxSize1();
void RecalcSizesRespectsMaxSize2();
void IncompatibleFlags();
wxWindow *m_win;
wxSizer *m_sizer;
@@ -376,3 +378,10 @@ void BoxSizerTestCase::RecalcSizesRespectsMaxSize2()
CPPUNIT_ASSERT_EQUAL(50, child2->GetSize().GetHeight());
CPPUNIT_ASSERT_EQUAL(125, child3->GetSize().GetHeight());
}
void BoxSizerTestCase::IncompatibleFlags()
{
WX_ASSERT_FAILS_WITH_ASSERT(
m_sizer->Add(10, 10, 0, wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL)
);
}