gtkflow-node-test.vala 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.with_type (typeof(bool));
  35. var src1 = new GFlow.SimpleSource.with_type (typeof(bool));
  36. try {
  37. src1.set_value(true);
  38. } catch {
  39. assert_not_reached();
  40. }
  41. var n1 = new GFlow.SimpleNode ();
  42. n1.add_sink (s1);
  43. var n2 = new GFlow.SimpleNode ();
  44. n2.add_source (src1);
  45. nview.add_node (n1);
  46. nview.add_node (n2);
  47. window.destroy ();
  48. } catch (Error e) {
  49. GLib.message ("ERROR: "+e.message);
  50. assert_not_reached ();
  51. }
  52. return 0;
  53. }
  54. }
  55. public class GtkFlowTest.NodeTest
  56. {
  57. public static void add_tests ()
  58. {
  59. Test.add_func ("/gtkflow/node",
  60. () => {
  61. var app = new GuiNodeTest ();
  62. app.run ();
  63. assert (app.status);
  64. });
  65. }
  66. }