-
Notifications
You must be signed in to change notification settings - Fork 779
Release v2.4.11 #5540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+196
−0
Merged
Release v2.4.11 #5540
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
55949ba
Initial plan
Copilot 27716ff
Fix unbounded UICatalog log capture memory growth
Copilot dfa5f22
Potential fix for pull request finding
tig c579374
Potential fix for pull request finding
tig dec1d4a
Add failing repro test for #5518: ImageView overwrites neighbour's pa…
tig cb40d11
Fix #5518: set attribute before drawing Padding adornment thickness
tig ba1e0c2
Merge pull request #5465 from tui-cs/copilot/fix-memory-leak
tig d7cc579
Merge pull request #5519 from tui-cs/tig/imageview-x-minus-1-overdraw…
tig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| using Microsoft.Extensions.Logging; | ||
| using UICatalog; | ||
|
|
||
| namespace IntegrationTests; | ||
|
|
||
| public class ScenarioLogCaptureTests | ||
| { | ||
| [Fact] | ||
| public void LogBuffer_IsTrimmed_WhenItGrowsTooLarge () | ||
| { | ||
| ScenarioLogCapture capture = new (); | ||
| ILogger logger = capture.CreateLogger ("test"); | ||
| string message = new ('x', 4096); | ||
|
|
||
| for (var i = 0; i < 120; i++) | ||
| { | ||
| logger.LogInformation ("{Message}", message); | ||
| } | ||
|
|
||
| Assert.True (capture.GetAllLogs ().Length <= 256_000); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void GetScenarioLogs_RespectsScenarioStart_AfterTrim () | ||
| { | ||
| ScenarioLogCapture capture = new (); | ||
| ILogger logger = capture.CreateLogger ("test"); | ||
| string message = new ('y', 4096); | ||
|
|
||
| // Fill close to the cap so the next few entries will trigger a trim. | ||
| while (capture.GetAllLogs ().Length < 250_000) | ||
| { | ||
| logger.LogInformation ("{Message}", message); | ||
| } | ||
|
|
||
| logger.LogInformation ("before-start"); | ||
|
|
||
| capture.MarkScenarioStart (); | ||
|
|
||
| int lengthBefore = capture.GetAllLogs ().Length; | ||
| bool trimmed = false; | ||
|
|
||
| for (int i = 0; i < 50; i++) | ||
| { | ||
| logger.LogInformation ("{Message}", message); | ||
|
|
||
| int lengthAfter = capture.GetAllLogs ().Length; | ||
|
|
||
| if (lengthAfter < lengthBefore) | ||
| { | ||
| trimmed = true; | ||
| break; | ||
| } | ||
|
|
||
| lengthBefore = lengthAfter; | ||
| } | ||
|
|
||
| Assert.True (trimmed); | ||
|
|
||
| logger.LogInformation ("after-start"); | ||
|
|
||
| string logs = capture.GetScenarioLogs (); | ||
| Assert.DoesNotContain ("before-start", logs); | ||
| Assert.Contains ("after-start", logs); | ||
| } | ||
| } |
86 changes: 86 additions & 0 deletions
86
Tests/UnitTestsParallelizable/Views/ImageViewNeighbourPaddingTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| namespace ViewsTests; | ||
|
|
||
| /// <summary> | ||
| /// Regression for gui-cs/Terminal.Gui#5518. | ||
| /// <para> | ||
| /// A raster <see cref="ImageView"/> placed at <see cref="Pos.Right"/> of a view that has a right | ||
| /// <see cref="Adornment"/> padding column overwrites that padding column — the cell one to the | ||
| /// LEFT of the ImageView's frame — when it redraws. The full first draw repaints the neighbour so | ||
| /// it looks correct; a <em>partial</em> redraw (a focus round-trip here) leaves the overwrite | ||
| /// behind, bleeding the image pane's background into the neighbour. | ||
| /// </para> | ||
| /// <para> | ||
| /// Surfaced in winprint (gui-cs/Terminal.Gui#5518) as the page-preview pane bleeding its canvas | ||
| /// colour into the settings panel's seam, on both Sixel and Kitty. It is not actually | ||
| /// raster-specific — a plain <see cref="View"/> at <see cref="Pos.Right"/> reproduces it too — so | ||
| /// the fix most likely belongs in the View draw/clip path, not the raster code. | ||
| /// </para> | ||
| /// </summary> | ||
| public class ImageViewNeighbourPaddingTests | ||
| { | ||
| [Fact] | ||
| public void Draw_RightOfPaddedNeighbour_DoesNotOverwriteNeighboursPaddingColumn () | ||
| { | ||
| using IApplication app = Application.Create (); | ||
| app.Init (DriverRegistry.Names.ANSI); | ||
| app.Driver!.SetScreenSize (40, 12); | ||
|
|
||
| Runnable runnable = new () { Width = 40, Height = 12 }; | ||
| runnable.SetScheme (new Scheme { Normal = new Attribute (new Color (255, 255, 255), new Color (26, 26, 26)) }); | ||
| app.Begin (runnable); | ||
|
|
||
| DriverImpl driver = (DriverImpl)app.Driver!; | ||
| driver.SetSixelSupport (new SixelSupportResult { IsSupported = true, Resolution = new Size (9, 20), MaxPaletteColors = 256 }); | ||
|
|
||
| // Left pane with a one-column right Padding — that padding column is the "seam". | ||
| View left = new () { X = 0, Y = 0, Width = 10, Height = Dim.Fill (), CanFocus = true }; | ||
| left.Padding!.Thickness = new Thickness (0, 0, 1, 0); | ||
| left.SetScheme (new Scheme { Normal = new Attribute (new Color (255, 255, 255), new Color (200, 0, 0)) }); | ||
|
|
||
| // Raster ImageView immediately to the right of the seam. | ||
| Color gray = new (224, 224, 224); | ||
| ImageView img = new () { X = Pos.Right (left), Y = 0, Width = Dim.Fill (), Height = Dim.Fill (), CanFocus = true }; | ||
| img.SetScheme (new Scheme { Normal = new Attribute (new Color (0, 0, 0), gray) }); | ||
| img.Image = CreateSolidImage (90, 200, gray); | ||
|
|
||
| // ImageView added first, neighbour on top: the full first draw repaints the seam correctly. | ||
| runnable.Add (img, left); | ||
|
|
||
| img.SetFocus (); | ||
| app.LayoutAndDraw (); | ||
| app.LayoutAndDraw (); | ||
|
|
||
| int seam = img.ViewportToScreen ().X - 1; // the neighbour's padding column, outside the image frame | ||
| int row = img.ViewportToScreen ().Y + 2; | ||
|
|
||
| Attribute? before = driver.GetOutputBuffer ().Contents! [row, seam].Attribute; | ||
|
|
||
| // Partial redraw: focus the neighbour, then focus back to the image. | ||
| left.SetFocus (); | ||
| app.LayoutAndDraw (); | ||
| img.SetFocus (); | ||
| app.LayoutAndDraw (); | ||
|
|
||
| Attribute? after = driver.GetOutputBuffer ().Contents! [row, seam].Attribute; | ||
|
|
||
| // The ImageView must not have changed a cell outside (to the left of) its own frame. | ||
| Assert.Equal (before, after); | ||
|
|
||
| runnable.Dispose (); | ||
| } | ||
|
|
||
| private static Color [,] CreateSolidImage (int width, int height, Color color) | ||
| { | ||
| Color [,] image = new Color [width, height]; | ||
|
|
||
| for (var x = 0; x < width; x++) | ||
| { | ||
| for (var y = 0; y < height; y++) | ||
| { | ||
| image [x, y] = color; | ||
| } | ||
| } | ||
|
|
||
| return image; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.