Merge pull request #2072 from BDisp/drawcontentcomplete-fix

Fixes #2071. DrawContentComplete event is never called from the base if it's overridden.
This commit is contained in:
Tig Kindel
2022-09-29 10:46:03 -07:00
committed by GitHub
2 changed files with 19 additions and 0 deletions

View File

@@ -1548,6 +1548,7 @@ namespace Terminal.Gui {
};
view.OnDrawContent (rect);
view.Redraw (rect);
view.OnDrawContentComplete (rect);
}
}
view.NeedDisplay = Rect.Empty;

View File

@@ -3892,5 +3892,23 @@ This is a tes
This is a tes
", output);
}
[Fact, AutoInitShutdown]
public void DrawContentComplete_Event_Is_Always_Called ()
{
var viewCalled = false;
var tvCalled = false;
var view = new View ("View") { Width = 10, Height = 10 };
view.DrawContentComplete += (e) => viewCalled = true;
var tv = new TextView () { Y = 11, Width = 10, Height = 10 };
tv.DrawContentComplete += (e) => tvCalled = true;
Application.Top.Add (view, tv);
Application.Begin (Application.Top);
Assert.True (viewCalled);
Assert.True (tvCalled);
}
}
}