public void ToolStripItemGroup_ApplicationIdle() { var testItem = new TestToolStripItem(); var sut = new ToolStripItemGroupManager(null); var group1 = sut.Create <ApplicationIdleToolStripItemGroup.Group1>(new ToolStripItem[] { testItem }); var group2 = sut.Create <ApplicationIdleToolStripItemGroup.Group2>(new ToolStripItem[] { testItem }); var group3 = sut.Create <ApplicationIdleToolStripItemGroup.Group3>(new ToolStripItem[] { testItem }); Application.RaiseIdle(null); Assert.IsTrue(group1.ApplicationIdleCalled); Assert.IsTrue(group2.ApplicationIdleCalled); Assert.IsTrue(group3.ApplicationIdleCalled); }
public void ToolStripItemGroup_Add_CustomToolStripItem() { var statusLabel = new ToolStripStatusLabel(); var tsiGroupManager = new ToolStripItemGroupManager(statusLabel); var externalObject = new TestToolStripItem(); var item = new TestToolStripItem(); sut = tsiGroupManager.Create <TestToolStripItemGroupAddOverride>(new[] { item }, ToolStripItemGroupImage, externalObject); Assert.AreEqual(tsiGroupManager, sut.ToolStripItemGroupManager); sut.Add(item); item.PerformClick(); var mouseClick2Called = false; sut.MyMouseClick += (s, e) => { mouseClick2Called = true; }; item.PerformClick(); Assert.IsTrue(mouseClick2Called); Assert.AreEqual(sut.Image, item.Image); Assert.AreEqual(sut.Text, item.Text); Assert.AreEqual(sut.ToolTipText, item.ToolTipText); Assert.AreEqual(externalObject, sut.ExternalObject); }
public void ToolStripItemGroup_Add_ToolStripButton() { var statusLabel = new ToolStripStatusLabel(); var tsiGroupManager = new ToolStripItemGroupManager(statusLabel); var item = new ToolStripButton() { CheckOnClick = true, Checked = true }; sut = tsiGroupManager.Create <TestToolStripItemGroup>(new[] { item }, ToolStripItemGroupImage); sut.Add(item); Assert.IsFalse(item.CheckOnClick); Assert.IsFalse(item.Checked); Assert.IsFalse(sut.Checked); item.Checked = true; Assert.IsTrue(sut.Checked); var mouseClick2Called = false; sut.MyMouseClick += (s, e) => { mouseClick2Called = true; }; item.PerformClick(); Assert.IsTrue(mouseClick2Called); Assert.AreEqual(sut.Image, item.Image); Assert.AreEqual(sut.Text, item.Text); Assert.AreEqual(sut.ToolTipText, item.ToolTipText); }
public Form1() { InitializeComponent(); ItemGroupManager = new ToolStripItemGroupManager(toolStripStatusLabel1) { IsLicensed = IsLicensed }; CheckboxItemGroupManager = new ToolStripItemCheckboxGroupManager(toolStripStatusLabel1) { IsLicensed = IsLicensed }; _One = ItemGroupManager.Create <One>(new ToolStripItem[] { oneToolStripMenuItem, toolStripButton1, aToolStripMenuItem }, oneToolStripMenuItem.Image, this); _Two = ItemGroupManager.Create <Two>(new ToolStripItem[] { twoToolStripMenuItem, toolStripSplitButton2, bToolStripMenuItem }); _Three = ItemGroupManager.Create <Three>(new ToolStripItem[] { threeToolStripMenuItem, toolStripButton3, cToolStripMenuItem }); _Four = ItemGroupManager.Create <Four>(new ToolStripItem[] { toolStripButton4, dToolStripMenuItem }); CheckboxItemGroupManager.CreateHome <Left>(new ToolStripItem[] { tsb1, leftToolStripMenuItem }, externalObject: label1).Checked = true; CheckboxItemGroupManager.Create <Center>(new ToolStripItem[] { tsb2, centerToolStripMenuItem }, externalObject: label1); CheckboxItemGroupManager.Create <Right>(new ToolStripItem[] { tsb3, rightToolStripMenuItem }, externalObject: label1); }
public void ToolStripItemGroup_MouseEnter_MouseLeave() { var statusLabel = new ToolStripStatusLabel(); var tsiGroupManager = new ToolStripItemGroupManager(statusLabel); //var sut = new TestToolStripItemGroup(ToolStripItemGroupImage); var item = new TestToolStripItem(); sut = tsiGroupManager.Create <TestToolStripItemGroupAddOverride>(new[] { item }); sut.Add(item); var mouseEntered = false; var mouseLeft = false; item.MouseEnter += (s, e) => { mouseEntered = true; }; item.MouseLeave += (s, e) => { mouseLeft = true; }; Assert.AreEqual(String.Empty, statusLabel.Text); item.PerformMouseEnter(new EventArgs()); Assert.IsTrue(mouseEntered); Assert.AreEqual(sut.ToolTipText, statusLabel.Text); item.PerformMouseLeave(null); Assert.IsTrue(mouseLeft); Assert.AreEqual(String.Empty, statusLabel.Text); }