Files
OpenNest/OpenNest.WinForms.Tests/Forms/EditNestPlateStockTooltipTests.cs
T
ajandClaude Opus 5.5 c82a4afc7a feat(desktop): show plate previews in the Plates list
The Plates tab becomes a card list like the drawings list: each row shows a
picture of the sheet with its parts in their drawing colors, beside the plate
number, size, quantity, part count and utilization. Pictures are cached per
plate and redrawn only when the sheet or a part's placement changes; the list
repaints after each recorded edit so moves and rotations show.

Drag and Ctrl+drag reordering, Alt+Up/Down, the row menu (a right-click now
selects its row), double-click to edit and the stock tooltip carry over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 21:20:10 -05:00

34 lines
1.3 KiB
C#

using System.Windows.Forms;
using OpenNest.Controls;
using OpenNest.Forms;
using OpenNest.Shapes;
namespace OpenNest.WinForms.Tests.Forms;
/// <summary>The plate list names each coded plate's inventory item, with its ledger location when known.</summary>
public class EditNestPlateStockTooltipTests
{
[Fact]
public void CodedPlateShowsItsStockInThePlateListTooltip() => RunSta(() =>
{
var nest = new Nest("stock tooltip");
var drawing = new RectangleShape { Name = "SYN", Length = 4, Width = 2 }.GetDrawing();
nest.Drawings.Add(drawing);
var plate = nest.CreatePlate();
plate.Parts.Add(new Part(drawing));
plate.StockItemCodes = ["DROP-1182"];
using var form = new EditNestForm(nest);
form.PlateView.SetOverlapAutoCheck(null);
form.LedgerLocations["DROP-1182"] = "B3";
form.UpdatePlateList();
var plates = Assert.IsType<PlateListBox>(Assert.Single(form.Controls.Find("platesListView", true)));
Assert.Equal("Stock: DROP-1182 (B3)", plates.GetToolTipText(0));
Assert.Equal("", plates.GetToolTipText(plates.Items.Count - 1));
});
private static void RunSta(System.Action testBody) =>
StaTestThread.Run(testBody, TimeSpan.FromSeconds(60), "The stock tooltip STA test did not complete.");
}