Exemplo n.º 1
0
        public void record_sets_history_empty_when_no_items()
        {
            var map = new HOTASButton();

            map.Record();
            map.Cancel();
            Assert.Empty(map.ActionCatalogItem.Actions);
        }
Exemplo n.º 2
0
        public void record_sets_keyboard_state_true()
        {
            Keyboard.IsKeySuppressionActive = false;
            var map = new HOTASButton();

            map.Record();
            Assert.True(Keyboard.IsKeySuppressionActive);
        }
Exemplo n.º 3
0
        public void cancel_sets_keyboard_state_false()
        {
            Keyboard.IsKeySuppressionActive = false;
            var map = new HOTASButton();

            map.Record();
            map.Cancel();
            Assert.False(Keyboard.IsKeySuppressionActive);
        }
Exemplo n.º 4
0
        public void record_adds_action()
        {
            var map = new HOTASButton();

            map.Record();

            Keyboard.SimulateKeyPressTest(1, false, false);

            Assert.Single(map.ActionCatalogItem.Actions);
        }
Exemplo n.º 5
0
        public void record_clears_actions()
        {
            var map = new HOTASButton();

            map.ActionCatalogItem.Actions.Add(new ButtonAction()
            {
                ScanCode = 1, IsExtended = true, TimeInMilliseconds = 1
            });
            map.Record();
            Assert.Empty(map.ActionCatalogItem.Actions);
        }
Exemplo n.º 6
0
        public void record_sets_history_with_one_item()
        {
            var map  = new HOTASButton();
            var item = new ButtonAction()
            {
                ScanCode = 1, IsExtended = true, TimeInMilliseconds = 1
            };

            map.ActionCatalogItem.Actions.Add(item);
            map.Record();
            map.Cancel();
            Assert.NotEmpty(map.ActionCatalogItem.Actions);
            Assert.Same(item, map.ActionCatalogItem.Actions.First());
        }
Exemplo n.º 7
0
        public void stop_keeps_only_new_actions()
        {
            var map  = new HOTASButton();
            var item = new ButtonAction()
            {
                ScanCode = 1, IsExtended = true, TimeInMilliseconds = 1
            };

            map.ActionCatalogItem.Actions.Add(item);
            map.Record();

            var newItem = new ButtonAction()
            {
                ScanCode = 1, IsExtended = true, TimeInMilliseconds = 1
            };

            map.ActionCatalogItem.Actions.Add(newItem);

            map.Stop();
            Assert.NotSame(item, map.ActionCatalogItem.Actions.First());
            Assert.Same(newItem, map.ActionCatalogItem.Actions.First());
        }