Skip to content

Commit

Permalink
Merge pull request #297 from opentween/add-tweenmain-testcase
Browse files Browse the repository at this point in the history
TweenMain.RemoveSpecifiedTabに対するテストコードを追加
  • Loading branch information
upsilon authored Jan 13, 2024
2 parents a632e4f + 5434b0f commit 153767e
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions OpenTween.Tests/TweenMainTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,37 @@ public void AddNewTab_PublicSearchTabTest()
});
}

[WinFormsFact]
public void RemoveSpecifiedTab_Test()
{
this.UsingTweenMain((tweenMain, context) =>
{
Assert.Equal(4, tweenMain.ListTab.TabPages.Count);

var tab = new PublicSearchTabModel("hoge")
{
SearchWords = "#OpenTween",
SearchLang = "ja",
};
context.TabInfo.AddTab(tab);
tweenMain.AddNewTab(tab, startup: false);
Assert.Equal(5, tweenMain.ListTab.TabPages.Count);

var tabPage = tweenMain.ListTab.TabPages[4];
var listView = (DetailsListView)tabPage.Controls[0];
var searchPanel = (Panel)tabPage.Controls[1];
Assert.Equal("hoge", tabPage.Text);

tweenMain.RemoveSpecifiedTab("hoge", confirm: false);

Assert.Equal(4, tweenMain.ListTab.TabPages.Count);
Assert.False(context.TabInfo.ContainsTab("hoge"));
Assert.True(tabPage.IsDisposed);
Assert.True(listView.IsDisposed);
Assert.True(searchPanel.IsDisposed);
});
}

[WinFormsFact]
public void RefreshTimeline_Test()
{
Expand Down

0 comments on commit 153767e

Please sign in to comment.