forked from KeeTrayTOTP/KeeTrayTOTP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed missing shortcut keys on mono (KeeTrayTOTP#158)
This was done cause of a bug in mono: The constructor which takes an shortcut key, doesn't probably handle this parameter. see https://github.com/mono/mono/blob/169a842f4e913608b17a1e5f38bcb635063b8dc8/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolStripMenuItem.cs#L83
- Loading branch information
Showing
2 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
using FluentAssertions; | ||
using KeePass.UI; | ||
using KeePass.Util; | ||
using KeeTrayTOTP.Menu; | ||
using KeeTrayTOTP.Tests.Extensions; | ||
using KeeTrayTOTP.Tests.Helpers; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace KeeTrayTOTP.Tests.Menu | ||
{ | ||
[TestClass] | ||
public class EntryMenuItemProviderTests | ||
{ | ||
private EntryMenuItemProvider _entryMenuItemProvider; | ||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
var (plugin, host) = PluginHostHelper.CreateAndInitialize(); | ||
|
||
_entryMenuItemProvider = new EntryMenuItemProvider(plugin, host.Object); | ||
} | ||
|
||
[TestMethod] | ||
public void EntryMenuItemProvider_Should_ProvideAllMenuItemsWithCorrectShortcutKeys() | ||
{ | ||
var sut = _entryMenuItemProvider.ProvideMenuItem(); | ||
|
||
sut.DropDownItems.Count.Should().Be(3, | ||
"because, there are exactly three menu items for an entry."); | ||
|
||
sut.DropDownItems | ||
.Cast<ToolStripMenuItem>() | ||
.All(menuItem => menuItem.ShortcutKeys != Keys.None) | ||
.Should().BeTrue("because, all entries should have a shortcut key assigned."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters