z803_useCase_KbdKeyboard_tst.java 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. XOWA: the XOWA Offline Wiki Application
  3. Copyright (C) 2012-2017 gnosygnu@gmail.com
  4. XOWA is licensed under the terms of the General Public License (GPL) Version 3,
  5. or alternatively under the terms of the Apache License Version 2.0.
  6. You may use XOWA according to either of these licenses as is most appropriate
  7. for your project on a case-by-case basis.
  8. The terms of each license can be found in the source code repository:
  9. GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
  10. Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
  11. */
  12. package gplx.gfml; import gplx.*;
  13. import org.junit.*;
  14. public class z803_useCase_KbdKeyboard_tst {
  15. String raw; GfmlDoc gdoc;
  16. @Test public void Quote() { // smokeTest; make sure DefaultLxr supports both quoting mechanisms
  17. fx.tst_Parse(String_.Concat
  18. ( "gfui-keyboard-ui:{"
  19. , " keyQuote {"
  20. , " \"'\" 'key.quote';"
  21. , " '\"' 'key.quote+key.shift' shift;"
  22. , " }"
  23. , "}"
  24. )
  25. , fx.nde_().Hnd_("gfui-keyboard-ui").Subs_
  26. ( fx.nde_().Atru_("keyQuote").Subs_
  27. ( fx.nde_().Atrs_("'", "key.quote")
  28. , fx.nde_().Atrs_("\"", "key.quote+key.shift", "shift")
  29. )
  30. )
  31. );
  32. }
  33. @Test public void Key_LtrA() {
  34. fx.tst_Parse(String_.Concat
  35. ( TypeHeader
  36. , "keys:{"
  37. , " keyA {"
  38. , " a 'key.a';"
  39. , " A 'key.a+key.shift' shift;"
  40. , " }"
  41. , "}"
  42. )
  43. , fx.nde_().Hnd_("keys").Subs_
  44. ( fx.nde_().Hnd_("key").Typ_("keys/key").Atrk_("size", "48,45").Atrk_("relAnchor", "{previous},rightOf").Atrk_("id", "keyA").Subs_
  45. ( fx.nde_().Hnd_("sendKeyCode").Typ_("sendKeyCode").Atrk_("modifier", "normal").Atrk_("displayText", "a").Atrk_("keyCode", "key.a")
  46. , fx.nde_().Hnd_("sendKeyCode").Typ_("sendKeyCode").Atrk_("displayText", "A").Atrk_("keyCode", "key.a+key.shift").Atrk_("modifier", "shift")
  47. )
  48. )
  49. );
  50. }
  51. @Test public void Load_Smoke() {
  52. Io_url url = Tfds.RscDir.GenSubFil_nest("110_gfml", "cfgs_archive", "gfui-keyboard-ui.cfg.gfml");
  53. raw = Io_mgr.Instance.LoadFilStr(url);
  54. gdoc = GfmlDoc_.parse_any_eol_(raw);
  55. // Tfds.Write(gdoc.RootNde().To_str());
  56. }
  57. String TypeHeader = String_.Concat
  58. ( "_type:{"
  59. , " keys {"
  60. , " key {"
  61. , " id;"
  62. , " size default='48,45';"
  63. , " relAnchor default='{previous},rightOf';"
  64. , " sendKeyCode type=sendKeyCode;"
  65. , " }"
  66. , " }"
  67. , " sendKeyCode {"
  68. , " displayText;"
  69. , " keyCode;"
  70. , " modifier default=normal;"
  71. , " }"
  72. , " changeModifier {"
  73. , " displayText;"
  74. , " modifier default=normal;"
  75. , " newModifierId;"
  76. , " isSticky;"
  77. , " }"
  78. , "}"
  79. );
  80. GfmlTypeCompiler_fxt fx = GfmlTypeCompiler_fxt.new_();
  81. }