Add dummy sibling window in TextCtrlTestCase to avoid GTK lone-child sizing

Same issue as ClippingBoxTestCase::wxPaintDC: a sole child window gets
stretched to fill the parent under wxGTK, breaking HitTest() and the
multiline PositionToCoords* tests via a wrongly inflated allocation.
This commit is contained in:
Scott Talbert
2026-08-31 20:01:37 -04:00
parent 54c2d9df83
commit 0e96f1dfa0
+3
View File
@@ -118,6 +118,8 @@ protected:
std::unique_ptr<wxTextCtrl> m_text;
std::unique_ptr<wxWindow> m_dummySibling;
const long m_style;
wxDECLARE_NO_COPY_CLASS(TextCtrlTestCase);
@@ -197,6 +199,7 @@ void TextCtrlTestCase::CreateText(long extraStyles)
{
const long style = m_style | extraStyles;
const int h = (style & wxTE_MULTILINE) ? TEXT_HEIGHT : -1;
m_dummySibling = make_unique<wxWindow>(wxTheApp->GetTopWindow(), wxID_ANY);
m_text = make_unique<wxTextCtrl>(wxTheApp->GetTopWindow(), wxID_ANY, "",
wxDefaultPosition, wxSize(400, h),
style);