//this is Currently untestable, the layout has been tested in the CreateControlPanel method. /// <summary> /// Shows the form to the user /// </summary> public DialogResult ShowDialog() { IPanel panel = createControlPanel(); IOKCancelDialogFactory okCancelDialogFactory = _controlFactory.CreateOKCancelDialogFactory(); IFormHabanero form = okCancelDialogFactory.CreateOKCancelForm(panel, ""); return(form.ShowDialog()); }
public void Test_Visually_Advanced() { //---------------Set up test pack------------------- IControlFactory controlFactory = GetControlFactory(); IGroupBox groupBox = controlFactory.CreateGroupBox("Test Layout"); IPanel panel = controlFactory.CreatePanel(); panel.Dock = DockStyle.Fill; groupBox.Controls.Add(panel); ColumnLayoutManager columnLayoutManager = new ColumnLayoutManager(panel, controlFactory) { ColumnCount = 1 }; int controlNumber = 1; IPanel panel1 = CreateColoredPanel(controlFactory, controlNumber++ + ":"); panel1.Controls.Clear(); GridLayoutManager gridLayoutManager = new GridLayoutManager(panel1, controlFactory); gridLayoutManager.SetGridSize(4, 3); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "a:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "b:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "c:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "d:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "e:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "f:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "g:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "h:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "i:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "j:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "k:")); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "l:")); columnLayoutManager.AddControl(panel1); columnLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":")); IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl(); buttonGroupControl.Dock = DockStyle.Top; groupBox.Controls.Add(buttonGroupControl); buttonGroupControl.AddButton("Add Control", (sender, e) => columnLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":"))); buttonGroupControl.AddButton("-Columns", (sender, e) => { if (columnLayoutManager.ColumnCount > 1) { columnLayoutManager.ColumnCount--; columnLayoutManager.Refresh(); } }); buttonGroupControl.AddButton("+Columns", (sender, e) => { columnLayoutManager.ColumnCount++; columnLayoutManager.Refresh(); }); IFormHabanero form = controlFactory.CreateOKCancelDialogFactory().CreateOKCancelForm(groupBox, "Test Column Layout Manager"); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- form.ShowDialog(); //---------------Test Result ----------------------- }
public void Test_Visually() { //---------------Set up test pack------------------- IControlFactory controlFactory = GetControlFactory(); IGroupBox groupBox = controlFactory.CreateGroupBox("Test Layout"); IPanel panel = controlFactory.CreatePanel(); panel.Dock = DockStyle.Fill; groupBox.Controls.Add(panel); GridLayoutManager gridLayoutManager = new GridLayoutManager(panel, controlFactory); gridLayoutManager.SetGridSize(6, 2); int controlNumber = 1; gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString())); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString())); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()), 2, 1); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString())); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString()), 2, 1); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString())); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString())); gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++.ToString())); //IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl(); //buttonGroupControl.Dock = DockStyle.Top; //groupBox.Controls.Add(buttonGroupControl); //buttonGroupControl.AddButton("Add Control", (sender, e) => gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":"))); //buttonGroupControl.AddButton("-Columns", (sender, e) => //{ // if (gridLayoutManager.ColumnCount > 1) // { // gridLayoutManager.ColumnCount--; // gridLayoutManager.Refresh(); // } //}); //buttonGroupControl.AddButton("+Columns", (sender, e) => { gridLayoutManager.ColumnCount++; gridLayoutManager.Refresh(); }); IFormHabanero form = controlFactory.CreateOKCancelDialogFactory().CreateOKCancelForm(groupBox, "Test Grid Layout Manager"); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- form.ShowDialog(); //---------------Test Result ----------------------- }
//this is Currently untestable, the layout has been tested in the CreateControlPanel method. /// <summary> /// Shows the form to the user /// </summary> public DialogResult ShowDialog() { IFormHabanero form = CreateOKCancelForm(); return(form.ShowDialog()); }