public void Test_Layout_WhenShortLabelAndCombo_ShouldMinimumWidthForWidth() { //---------------Set up test pack------------------- InputFormComboBox inputFormComboBox = CreateInputFormComboBoxWithThreeItems("x"); //---------------Execute Test ---------------------- IPanel panel = inputFormComboBox.CreateControlPanel(); //---------------Test Result ----------------------- Assert.AreEqual(200, panel.Width); }
public void Test_Layout_WhenLongLabel_ShouldUseLabelPreferredWidthForWidth() { //---------------Set up test pack------------------- const string message = "This is a very long message for testing the width of the form being determined by the message width."; InputFormComboBox inputFormComboBox = CreateInputFormComboBoxWithThreeItems(message); //---------------Execute Test ---------------------- IPanel panel = inputFormComboBox.CreateControlPanel(); //---------------Test Result ----------------------- Assert.AreEqual(2, panel.Controls.Count); ILabel label = TestUtil.AssertIsInstanceOf <ILabel>(panel.Controls[0]); Assert.AreEqual(label.PreferredWidth + 20, panel.Width); }
public void Test_Layout_WhenLongComboBoxItem_ShouldUseComboPreferredWidthForWidth() { //---------------Set up test pack------------------- InputFormComboBox inputFormComboBox = CreateInputFormComboBoxWithThreeItems(); const string longComboBoxItem = "This is a very long item for the purposes of testing the combo width"; inputFormComboBox.ComboBox.Items.Add(longComboBoxItem); //---------------Execute Test ---------------------- IPanel panel = inputFormComboBox.CreateControlPanel(); //---------------Test Result ----------------------- Assert.AreEqual(2, panel.Controls.Count); int longComboBoxItemPreferredWidth = GetControlFactory().CreateLabel(longComboBoxItem).PreferredWidth; Assert.AreEqual(longComboBoxItemPreferredWidth + 40, panel.Width); }
public void Test_Layout() { //---------------Set up test pack------------------- InputFormComboBox inputFormComboBox = CreateInputFormComboBoxWithThreeItems(); //---------------Execute Test ---------------------- IPanel panel = inputFormComboBox.CreateControlPanel(); //---------------Test Result ----------------------- Assert.AreEqual(2, panel.Controls.Count); ILabel label = TestUtil.AssertIsInstanceOf <ILabel>(panel.Controls[0]); IComboBox comboBox = TestUtil.AssertIsInstanceOf <IComboBox>(panel.Controls[1]); Assert.AreSame(inputFormComboBox.ComboBox, comboBox); Assert.That(label.Top + label.Height, Is.LessThan(comboBox.Top)); Assert.That(comboBox.Top + comboBox.Height, Is.LessThanOrEqualTo(panel.Height)); Assert.IsFalse(label.Font.Bold); Assert.AreEqual(panel.Width - 10, comboBox.Width, "Combo width should be panel width - border widths(5 pixels X 2)"); Assert.That(label.Width, Is.GreaterThan(label.PreferredWidth)); Assert.AreEqual(panel.Size, panel.MinimumSize); }