public void ShowingHidingMultipleTimesKeepsProperDeckOrdering() { ControlSmartPart smartPartA = new ControlSmartPart(); ControlSmartPart smartPartB = new ControlSmartPart(); ControlSmartPart smartPartC = new ControlSmartPart(); workspace.Show(smartPartA); workspace.Show(smartPartB); workspace.Show(smartPartC); workspace.Hide(smartPartC); Assert.AreSame(smartPartB, workspace.ActiveSmartPart); workspace.Hide(smartPartB); Assert.AreSame(smartPartA, workspace.ActiveSmartPart); workspace.Close(smartPartA); Assert.AreSame(smartPartC, workspace.ActiveSmartPart); workspace.Hide(smartPartC); Assert.AreSame(smartPartB, workspace.ActiveSmartPart); workspace.Hide(smartPartB); Assert.AreSame(smartPartC, workspace.ActiveSmartPart); }
public void FocusOnInnerControlActivatesContainingSmartPart() { ZoneWorkspaceForm form = new ZoneWorkspaceForm(); form.Show(); ControlSmartPart sp1 = new ControlSmartPart(); sp1.Size = new System.Drawing.Size(50, 50); TextBox tb1 = new TextBox(); sp1.Controls.Add(tb1); ControlSmartPart sp2 = new ControlSmartPart(); sp2.Size = new System.Drawing.Size(50, 50); TextBox tb2 = new TextBox(); sp2.Controls.Add(tb2); form.Workspace.Show(sp1, new ZoneSmartPartInfo("LeftZone")); form.Workspace.Show(sp2, new ZoneSmartPartInfo("ContentZone")); Assert.AreSame(sp2, form.Workspace.ActiveSmartPart); tb1.Select(); Assert.AreSame(sp1, form.Workspace.ActiveSmartPart); tb2.Select(); Assert.AreSame(sp2, form.Workspace.ActiveSmartPart); }
public void ShowFiresActivatedEventWithSPAsParameter() { ControlSmartPart smartPartA = new ControlSmartPart(); ZoneSmartPartInfo smartPartInfoA = new ZoneSmartPartInfo(); smartPartInfoA.ZoneName = "Zone"; Control zone = new Control(); workspace.Controls.Add(zone); workspace.SetZoneName(zone, "Zone"); bool activatedCalled = false; workspace.SmartPartActivated += delegate(object sender, WorkspaceEventArgs e) { activatedCalled = true; Assert.AreSame(e.SmartPart, smartPartA); }; workspace.Show(smartPartA, smartPartInfoA); Assert.IsTrue(smartPartA.Visible); Assert.IsTrue(activatedCalled); }
public void RemovingZoneUnregistersGotFocusEvent() { Control zone1 = new Control(); workspace.Controls.Add(zone1); workspace.SetZoneName(zone1, "TestZone"); Assert.AreEqual("TestZone", workspace.GetZoneName(zone1)); workspace.Controls.Remove(zone1); Assert.IsNull(workspace.GetZoneName(zone1)); Assert.AreEqual(0, workspace.Zones.Count); bool activatedCalled = false; workspace.SmartPartActivated += delegate(object sender, WorkspaceEventArgs e) { activatedCalled = true; }; ControlSmartPart sp = new ControlSmartPart(); zone1.Controls.Add(sp); Form form1 = new Form(); form1.Controls.Add(zone1); form1.Show(); Assert.IsFalse(activatedCalled); }
public void ShowWithNoSPIDoesNotOverrideDockInformation() { ControlSmartPart sp = new ControlSmartPart(); sp.Dock = DockStyle.Fill; AddZones(new Control(), new Control()); workspace.Show(sp); Assert.AreEqual(DockStyle.Fill, sp.Dock); }
public void DisposeNonActiveSmartPartDoesNotChangeActiveOne() { ControlSmartPart smartPartA = new ControlSmartPart(); ControlSmartPart smartPartB = new ControlSmartPart(); ControlSmartPart smartPartC = new ControlSmartPart(); workspace.Show(smartPartA); workspace.Show(smartPartB); workspace.Show(smartPartC); smartPartB.Dispose(); Assert.AreSame(smartPartC, workspace.ActiveSmartPart); }
public void ShowHideKeepsOrder() { ControlSmartPart c1 = new ControlSmartPart(); ControlSmartPart c2 = new ControlSmartPart(); ControlSmartPart c3 = new ControlSmartPart(); workspace.Show(c1); workspace.Show(c2); workspace.Show(c3); workspace.Show(c2); workspace.Hide(c2); Assert.AreSame(c3, workspace.ActiveSmartPart); }
public void HideNonActiveSmartPartDoesNotChangeCurrentOne() { ControlSmartPart smartPartA = new ControlSmartPart(); ControlSmartPart smartPartB = new ControlSmartPart(); ControlSmartPart smartPartC = new ControlSmartPart(); workspace.Show(smartPartA); workspace.Show(smartPartB); workspace.Show(smartPartC); workspace.Hide(smartPartB); Assert.AreSame(smartPartC, workspace.ActiveSmartPart); }
public void DisposeNonActiveElementHostDoesNotChangeActiveOne() { ControlSmartPart smartPartA = new ControlSmartPart(); ControlSmartPart smartPartB = new ControlSmartPart(); ControlSmartPart smartPartC = new ControlSmartPart(); workspace.Show(smartPartA); workspace.Show(smartPartB); workspace.Show(smartPartC); ElementHost hostB = catalog.Hosts[smartPartB]; hostB.Dispose(); Assert.AreSame(smartPartC, workspace.ActiveSmartPart); }
public void FiresOneEventOnlyIfSmartPartIsShownMultipleTimes() { // Show First SmartPart ControlSmartPart smartPartA = new ControlSmartPart(); ZoneSmartPartInfo smartPartInfoA = new ZoneSmartPartInfo(); smartPartInfoA.ZoneName = "Zone"; Control zone = new Control(); workspace.Controls.Add(zone); workspace.SetZoneName(zone, "Zone"); workspace.Show(smartPartA, smartPartInfoA); Assert.IsTrue(smartPartA.Visible); // Show Second SmartPart ControlSmartPart smartPartB = new ControlSmartPart(); ZoneSmartPartInfo smartPartInfoB = new ZoneSmartPartInfo(); smartPartInfoB.ZoneName = "Zone1"; Control zone1 = new Control(); workspace.Controls.Add(zone1); workspace.SetZoneName(zone1, "Zone1"); workspace.Show(smartPartB, smartPartInfoB); Assert.IsTrue(smartPartB.Visible); // Show first SmartPart again int activatedCalled = 0; workspace.SmartPartActivated += delegate(object sender, WorkspaceEventArgs e) { activatedCalled++; Assert.AreSame(e.SmartPart, smartPartA); }; workspace.Show(smartPartA, smartPartInfoA); Assert.AreEqual(1, activatedCalled); }
public void ShowGetsSmartPartInfoRegisteredWithWorkItem1() { ControlSmartPart smartPartA = new ControlSmartPart(); ZoneSmartPartInfo smartPartInfoA = new ZoneSmartPartInfo(); smartPartInfoA.ZoneName = "ZoneA"; smartPartInfoA.Dock = DockStyle.Left; workItem.RegisterSmartPartInfo(smartPartA, smartPartInfoA); Control zoneA = new Control(); workspace.Controls.Add(zoneA); workspace.SetZoneName(zoneA, "ZoneA"); workspace.Show(smartPartA); Assert.IsTrue(workspace.Zones["ZoneA"].Controls.Contains(smartPartA)); Assert.AreEqual(DockStyle.Left, smartPartA.Dock); }
public void RemovingZoneFromWorkspaceRemovesContainedSmartPart() { Control zone = new Control(); workspace.Controls.Add(zone); workspace.SetZoneName(zone, "TestZone3"); ControlSmartPart smartPartA = new ControlSmartPart(); ZoneSmartPartInfo spInfoA = new ZoneSmartPartInfo(); spInfoA.ZoneName = "TestZone3"; workspace.Show(smartPartA, spInfoA); zone.Focus(); Form f = new Form(); f.Controls.Add(zone); //Fails Assert.IsFalse(workspace.SmartParts.Contains(smartPartA)); }