/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { if (_renderStrip != null) { _renderStrip.Dispose(); _renderStrip = null; } } base.Dispose(disposing); }
public void BehaviorFindToolStrip() { // Default stuff Assert.AreEqual(null, ToolStripManager.FindToolStrip(string.Empty), "A1"); Assert.AreEqual(null, ToolStripManager.FindToolStrip("MyStrip"), "A2"); ToolStrip ts = new ToolStrip(); ts.Name = "MyStrip"; // Basic operation Assert.AreSame(ts, ToolStripManager.FindToolStrip("MyStrip"), "A3"); // Dispose removes them ts.Dispose(); Assert.AreEqual(null, ToolStripManager.FindToolStrip("MyStrip"), "A4"); ts = new ToolStrip(); ts.Name = "MyStrip1"; MenuStrip ms = new MenuStrip(); ms.Name = "MyStrip2"; // Basic operation Assert.AreSame(ts, ToolStripManager.FindToolStrip("MyStrip1"), "A5"); Assert.AreSame(ms, ToolStripManager.FindToolStrip("MyStrip2"), "A6"); // Find unnamed strip StatusStrip ss = new StatusStrip(); Assert.AreEqual(ss, ToolStripManager.FindToolStrip(string.Empty), "A7"); // Always return first unnamed strip ContextMenuStrip cms = new ContextMenuStrip(); Assert.AreEqual(ss, ToolStripManager.FindToolStrip(string.Empty), "A8"); // Remove first unnamed strip, returns second one ss.Dispose(); Assert.AreEqual(cms, ToolStripManager.FindToolStrip(string.Empty), "A9"); // ContextMenuStrips are included cms.Name = "Context"; Assert.AreEqual(cms, ToolStripManager.FindToolStrip("Context"), "A10"); }