X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=tests%2FValaTest.vala;h=2a7ec4c4c1f97a3ff4cfc63f46f944bde0dbc23e;hb=b28112d39ef063f657d5b18a42d5e5a904855c88;hp=4a50555a9275b159de9cc8dd88d41d818aa94baa;hpb=af59ce43c109b544b4808983dee7819a0698277a;p=app.Builder.js diff --git a/tests/ValaTest.vala b/tests/ValaTest.vala index 4a50555a9..2a7ec4c4c 100644 --- a/tests/ValaTest.vala +++ b/tests/ValaTest.vala @@ -3,39 +3,82 @@ */ - + + +void diff(string original, string data) +{ + + FileUtils.set_contents("/tmp/test.out",data); + string[] spawn_args = {"diff", "-w" , "-u", original, "/tmp/test.out" }; + + + string[] spawn_env = Environ.get (); + int ls_status; + Process.spawn_sync ("/", + spawn_args, + spawn_env, + SpawnFlags.SEARCH_PATH, + null, + null, + null, + out ls_status); + + +} + + + int main (string[] args) { Gtk.init (ref args); //GtkClutter.init (ref args); new JsRender.Lang_Class(); - GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); - Project.Project.loadAll(); -/* - var p = Palete.factory("Roo"); - var cl = p.getClass("Roo.form.Form").toJSON();; + GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); + + - var n = new Json.Node(Json.NodeType.OBJECT); - n.set_object(cl); - var generator = new Json.Generator (); - generator.indent = 4; - generator.pretty = true; - generator.set_root (n); + Project.Project.loadAll(); + var p = Project.Project.getProject("Builder4"); + p.scanDirs(); + var ar = p.sortedFiles(); + var iter = ar.list_iterator(); + while (iter.next()) { + var f= iter.get(); + f.loadItems(); - print(generator.to_data (null)); - */ + // syntax check.. + var a = new Palete.ValaSource(f); + + + + //print("\n%s\n",f.toJsonString()); + //diff(p.firstPath() + "/" + f.name + ".vala", JsRender.NodeToVala.mungeFile(f)); + //var str= + //print("\n%s\n",str); + //return 0; + } - var w = new Gtk.Window( Gtk.WindowType.TOPLEVEL ); + + return 0; +} + + +void testGir() { - var left_props =new Xcls_RightPalete(); - left_props.el.show_all(); - w.add(left_props.el); - w.show_all(); - - left_props.load(Palete.factory("Roo"), "Roo.form.Form"); - - Gtk.main(); + var test = Palete.Gir.factoryFqn("Gtk.Label.new"); + if (test == null) { + print("could not find Gtk.Label.new\n"); + return; + } + + + var generator = new Json.Generator (); + var n = new Json.Node(Json.NodeType.OBJECT); + n.set_object(test.toJSON()); + generator.set_root(n); + generator.indent = 4; + generator.pretty = true; + print(generator.to_data(null)); - return 0; } \ No newline at end of file