feat: special key reading
This commit is contained in:
parent
c475204437
commit
2a6f41713e
5 changed files with 144 additions and 8 deletions
|
@ -47,4 +47,55 @@ public class KeySequenceTests {
|
|||
|
||||
Assert.IsFalse(history.ContainsSequence(sequence));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BeginsWithSpecial_MustContain_Contains() {
|
||||
List<int> sequence = new() { 0x1, 0x2, 0x3 };
|
||||
KeyHistory history = new();
|
||||
|
||||
history.KeyPressed(0x5, true);
|
||||
history.KeyPressed(0x1);
|
||||
history.KeyPressed(0x2);
|
||||
history.KeyPressed(0x3);
|
||||
|
||||
Assert.IsTrue(history.ContainsSequence(sequence, 0x5, true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DoesntBeginWithSpecial_MustContain_DontContain() {
|
||||
List<int> sequence = new() { 0x1, 0x2, 0x3 };
|
||||
KeyHistory history = new();
|
||||
|
||||
history.KeyPressed(0x1);
|
||||
history.KeyPressed(0x1);
|
||||
history.KeyPressed(0x2);
|
||||
history.KeyPressed(0x3);
|
||||
|
||||
Assert.IsFalse(history.ContainsSequence(sequence, 0x5, true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BeginsWithSpecial_MustntContain_DontContain() {
|
||||
List<int> sequence = new() { 0x1, 0x2, 0x3 };
|
||||
KeyHistory history = new();
|
||||
|
||||
history.KeyPressed(0x5, true);
|
||||
history.KeyPressed(0x1);
|
||||
history.KeyPressed(0x2);
|
||||
history.KeyPressed(0x3);
|
||||
|
||||
Assert.IsFalse(history.ContainsSequence(sequence, 0x5, false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DoesntBeginWithSpecial_MustntContain_Contains() {
|
||||
List<int> sequence = new() { 0x1, 0x2, 0x3 };
|
||||
KeyHistory history = new();
|
||||
|
||||
history.KeyPressed(0x1);
|
||||
history.KeyPressed(0x2);
|
||||
history.KeyPressed(0x3);
|
||||
|
||||
Assert.IsTrue(history.ContainsSequence(sequence, 0x5, false));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue