Commit 6b289eec authored by Gerard Gascón's avatar Gerard Gascón
Browse files

fix: no false point on start

parent 2a6f4171
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -99,21 +99,7 @@ namespace Domain {
					return false;
			}

			for (int i = 0; i < _lastPressesWithSpecial.List.Count; i++) {
				if (i >= sequence.Count)
					break;

				int keyPressed = _lastPressesWithSpecial.List[_lastPressesWithSpecial.List.Count - 1 - i];
				int sequenceKey = sequence[sequence.Count - 1 - i];

				if (keyPressed != sequenceKey) {
					return false;
				}
			}

			_lastPressesWithSpecial.List.Clear();
			_lastPresses.List.Clear();
			return true;
			return ContainsSequence(sequence);
		}
	}
}
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
@@ -98,4 +98,12 @@ public class KeySequenceTests {

		Assert.IsTrue(history.ContainsSequence(sequence, 0x5, false));
	}

	[Test]
	public void NoPresses_MustntContain_DontContain() {
		List<int> sequence = new() { 0x1, 0x2, 0x3 };
		KeyHistory history = new();

		Assert.IsFalse(history.ContainsSequence(sequence, 0x5, false));
	}
}
 No newline at end of file