mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Add a combobox test
This commit is contained in:
parent
5406fc1d0d
commit
7345b1c466
@ -119,7 +119,8 @@
|
||||
<Compile Include="Logic\SubtitleFormats\SubtitleFormatsTest.cs" />
|
||||
<Compile Include="Logic\UtilitiesTest.cs" />
|
||||
<Compile Include="Dictionaries\XmlDictionariesTest.cs" />
|
||||
<Compile Include="SETextBoxControl\SeTextBoxTests.cs" />
|
||||
<Compile Include="UserControls\NikseComboBoxTests.cs" />
|
||||
<Compile Include="UserControls\SeTextBoxTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Dictionaries\en_US.aff" />
|
||||
|
52
src/Test/UserControls/NikseComboBoxTests.cs
Normal file
52
src/Test/UserControls/NikseComboBoxTests.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Nikse.SubtitleEdit.Controls;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Test.UserControls
|
||||
{
|
||||
[TestClass]
|
||||
public class NikseComboBoxTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void NikseComboBox()
|
||||
{
|
||||
|
||||
var cbNormal = new ComboBox { DropDownStyle = ComboBoxStyle.DropDownList};
|
||||
var normalSelectedIndexChangedCount = 0;
|
||||
cbNormal.SelectedIndexChanged += (sender, args) => { normalSelectedIndexChangedCount++; };
|
||||
var normalSelectedValueChangedCount = 0;
|
||||
cbNormal.SelectedValueChanged += (sender, args) => { normalSelectedValueChangedCount++; };
|
||||
|
||||
var cbNikse = new NikseComboBox { DropDownStyle = ComboBoxStyle.DropDownList };
|
||||
var nikseSelectedIndexChangedCount = 0;
|
||||
cbNikse.SelectedIndexChanged += (sender, args) => { nikseSelectedIndexChangedCount++; };
|
||||
var nikseSelectedValueChangedCount = 0;
|
||||
cbNikse.SelectedValueChanged += (sender, args) => { nikseSelectedValueChangedCount++; };
|
||||
|
||||
cbNormal.Items.Add("Test");
|
||||
cbNikse.Items.Add("Test");
|
||||
|
||||
Verify(normalSelectedIndexChangedCount, nikseSelectedIndexChangedCount, normalSelectedValueChangedCount, nikseSelectedValueChangedCount, cbNormal, cbNikse);
|
||||
|
||||
cbNormal.SelectedIndex = 0;
|
||||
cbNikse.SelectedIndex = 0;
|
||||
|
||||
Verify(normalSelectedIndexChangedCount, nikseSelectedIndexChangedCount, normalSelectedValueChangedCount, nikseSelectedValueChangedCount, cbNormal, cbNikse);
|
||||
|
||||
cbNormal.Items.Clear();
|
||||
cbNikse.Items.Clear();
|
||||
|
||||
Verify(normalSelectedIndexChangedCount, nikseSelectedIndexChangedCount, normalSelectedValueChangedCount, nikseSelectedValueChangedCount, cbNormal, cbNikse);
|
||||
}
|
||||
|
||||
private static void Verify(int normalSelectedIndexChangedCount, int nikseSelectedIndexChangedCount, int normalSelectedValueChangedCount, int nikseSelectedValueChangedCount, ComboBox cbNormal, NikseComboBox cbNikse)
|
||||
{
|
||||
Assert.AreEqual(normalSelectedIndexChangedCount, nikseSelectedIndexChangedCount);
|
||||
Assert.AreEqual(normalSelectedValueChangedCount, nikseSelectedValueChangedCount);
|
||||
Assert.AreEqual(cbNormal.SelectedIndex, cbNikse.SelectedIndex);
|
||||
//Assert.AreEqual(cbNormal.Text, cbNikse.Text);
|
||||
Assert.AreEqual(cbNormal.SelectedItem, cbNikse.SelectedItem);
|
||||
//Assert.AreEqual(cbNormal.SelectedText, cbNikse.SelectedText);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Nikse.SubtitleEdit.Controls;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using System;
|
||||
|
||||
namespace Test.SETextBoxControl
|
||||
namespace Test.UserControls
|
||||
{
|
||||
[TestClass]
|
||||
public class SeTextBoxTests
|
Loading…
Reference in New Issue
Block a user