From: Alan Knowles Date: Wed, 3 Sep 2014 14:49:41 +0000 (+0800) Subject: Test.GtkWriter.vala X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=50704c7ae7b4fd30e9f6c8bc6ea545b5990bc9b1;p=app.Builder.js Test.GtkWriter.vala --- diff --git a/Test.GtkWriter.vala b/Test.GtkWriter.vala deleted file mode 100644 index 52b0d7682..000000000 --- a/Test.GtkWriter.vala +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Test the writer code... - - -*/ - - -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); - - -} - -void testBuilderFile(string ptype, string dir, string name, string test) -{ - - var proj = Project.Project.factory( ptype, dir ); - proj.scanDirs(); - //print(proj.toJSON(true)); - //print("\ndone\n"); - var tf = proj.files.get(dir + "/" + name + ".bjs"); - tf.loadItems(); - switch(test) { - case "JSON": - diff(dir + "/" + name + ".bjs", tf.toJsonString()); - return; - case "JS": - diff(dir + "/" + name + ".js", tf.toSource()); - return; - case "VALA": - diff(dir + "/" + name + ".vala", tf.toValaSource(false)); - return; - case "PREVIEW": - print ("Calling to sourcepreview"); - print( tf.toSourcePreview()); - return; - } - print("invalid test?\n"); -} - - /* -void testLeftTree(string name) -{ - var dir = "/home/alan/gitlive/app.Builder.js/Builder4"; - var proj = new Project.Gtk(dir ); - proj.scanDirs(); - - var tf = proj.files.get(dir + "/" + name + ".bjs"); - tf.loadItems(); - var w = new Xcls_MainWindow(); - - var left_tree =new Xcls_WindowLeftTree(); - - w.vbox.el.pack_start(left_tree.el,true, true,0); - w.el.show_all(); - - left_tree.model.loadFile(tf); - -} - -void rooWindowTest(string name) -{ - - var proj = Project.Project.getProject("Pman.Core"); - - proj.scanDirs(); - - var tf = proj.getByName(name); - tf.loadItems(); - - var w = new Xcls_MainWindow(); - - var rv =new Xcls_WindowRooView(); - - w.vbox.el.pack_start(rv.el,true, true,0); - w.el.show_all(); - - rv.loadFile(tf); - -} - -void rooWindowClutter() -{ - var proj = Project.Project.getProject("Pman.Core"); - - proj.scanDirs(); - - - var w = new Xcls_MainWindow(); - w.ref(); - w.project = proj; - - - w.initChildren(); - w.el.show_all(); - -} -*/ -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();; - 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); - - print(generator.to_data (null)); - - - - //print ("Drop points for Gtk.ScrolledWindow are : " + - // string.joinv(", " , Palete.factory("Gtk").getDropList("Gtk.ScrolledWindow")) - //); - - //testBuilderFile("Gtk", "/home/alan/gitlive/app.Builder.js/Builder4" , "Editor", "JSON"); - //testBuilderFile("Gtk", "/home/alan/gitlive/app.Builder.js/Builder4, "Editor", "JS"); - //testBuilderFile("Gtk", "/home/alan/gitlive/app.Builder.js/Builder4","Editor", "VALA"); - //testBuilderFile("Roo", "/home/alan/gitlive/Pman.Core/","Pman.Dialog.CoreEmail", "PREVIEW"); - //testBuilderFile("Roo", "/home/alan/gitlive/Pman.Core/","Pman.Dialog.CoreEmailPreview", "PREVIEW"); - //testLeftTree("Editor"); - //rooWindowTest("Pman.Dialog.CoreEmailPreview");Gtk.main(); - //rooWindowTest("Pman.Dialog.CoreEmail"); Gtk.main(); - //rooWindowClutter(); Gtk.main(); - - - return 0; -} \ No newline at end of file