gtkflow-node-test.vala 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
  2. /* GtkFlowTest
  3. *
  4. * Copyright (C) 2015 Daniel Espinosa <esodan@gmail.com>
  5. *
  6. * librescl is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * librescl is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. * See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. using GFlow;
  20. using GtkFlow;
  21. public class GtkFlowTest.GuiNodeTest : GtkFlowTest.TestApp
  22. {
  23. public GuiNodeTest ()
  24. {
  25. base ();
  26. test_prefix = "/gtkflow/node";
  27. }
  28. public override int execute ()
  29. {
  30. try {
  31. GLib.message ("Executing Tests...");
  32. var nview = new GtkFlow.NodeView ();
  33. this.action_area.pack_end (nview);
  34. var s1 = new GFlow.SimpleSink (true);
  35. var src1 = new GFlow.SimpleSource (true);
  36. var n1 = new GFlow.SimpleNode ();
  37. n1.add_sink (s1);
  38. var n2 = new GFlow.SimpleNode ();
  39. n2.add_source (src1);
  40. nview.add_node (n1);
  41. nview.add_node (n2);
  42. window.destroy ();
  43. } catch (Error e) {
  44. GLib.message ("ERROR: "+e.message);
  45. assert_not_reached ();
  46. }
  47. return 0;
  48. }
  49. }
  50. public class GtkFlowTest.NodeTest
  51. {
  52. public static void add_tests ()
  53. {
  54. Test.add_func ("/gtkflow/node",
  55. () => {
  56. var app = new GuiNodeTest ();
  57. app.run ();
  58. assert (app.status);
  59. });
  60. }
  61. }