Package mindnotes.client.presentation

Examples of mindnotes.client.presentation.KeyboardShortcuts


  }

  @Test
  public void testKeyboardBindings() {
    KeyboardShortcuts ks = new KeyboardShortcuts();
    final Flag flag = new Flag();
    ks.addBinding(new KeyBinding('Z', true, false, false, new Command() {

      @Override
      public void execute() {
        flag.up();
      }
    }));

    flag.down();
    ks.onShortcutPressed('s', false, false, false);
    Assert.assertTrue(flag.isDown());

    flag.down();
    ks.onShortcutPressed('z', true, false, false);
    Assert.assertTrue(flag.isUp());

    flag.down();
    ks.onShortcutPressed('z', true, true, false);
    Assert.assertTrue(flag.isDown());

    flag.down();
    ks.onShortcutPressed('Z', true, false, false);
    Assert.assertTrue(flag.isUp());

  }
View Full Code Here


  }

  @Test
  public void testDoubleKeyboardBindings() {
    KeyboardShortcuts ks = new KeyboardShortcuts();
    final Flag flag1 = new Flag();
    final Flag flag2 = new Flag();
    ks.addBinding(new KeyBinding('Z', true, false, false, new Command() {

      @Override
      public void execute() {
        flag1.up();
      }
    }));

    ks.addBinding(new KeyBinding('Z', true, true, false, new Command() {

      @Override
      public void execute() {
        flag2.up();
      }
    }));

    flag1.down();
    flag2.down();
    ks.onShortcutPressed('z', true, false, false);
    Assert.assertTrue(flag1.isUp());
    Assert.assertTrue(flag2.isDown());

    flag1.down();
    flag2.down();
    ks.onShortcutPressed('z', true, true, false);
    Assert.assertTrue(flag1.isDown());
    Assert.assertTrue(flag2.isUp());

  }
View Full Code Here

TOP

Related Classes of mindnotes.client.presentation.KeyboardShortcuts

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.