]> matita.cs.unibo.it Git - helm.git/commitdiff
Test improved
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 8 Nov 2000 10:15:26 +0000 (10:15 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Wed, 8 Nov 2000 10:15:26 +0000 (10:15 +0000)
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.0/minidom/test.opt
helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.0/test/test.ml

index 20307125b44342b711b9933fe338588d085697d2..4f31b881542d5312f2d3ab39ddaf16efa04f49e0 100755 (executable)
Binary files a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.0/minidom/test.opt and b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.0/minidom/test.opt differ
index aeb2a60102a6049d5200f7af0e7d1c7af20439d1..4f9af18e55a346b4599efa879e4b1f6ba311248d 100644 (file)
@@ -32,10 +32,8 @@ let jump node =
 let selection_changed node =
  let module M = Minidom in
   print_string ("selection_changed: " ^
-   (match
-     M.node_get_name node
-    with
-       None   -> "selection_changed on nothing (???)" 
+   (match M.node_get_name node with
+       None   -> "selection_changed on nothing" 
      | Some s -> "selection changed on " ^ M.string_of_mDOMString s
    ) ^ "\n");
   flush stdout
@@ -45,9 +43,7 @@ let selection_changed node =
 let clicked node =
  let module M = Minidom in
   print_string ("clicked: " ^
-   (match
-     M.node_get_name node
-    with
+   (match M.node_get_name node with
        None   -> "Nothing clicked (???)" 
      | Some s -> M.string_of_mDOMString s ^ " clicked"
    ) ^ "\n");
@@ -72,29 +68,37 @@ let load mathview () =
  flush stdout
 ;;
 
-exception Ok;;
 let get_selection mathview () =
-(*
  let selection =
-  match !mathview#get_selection with
+(*  match !mathview#get_selection with
      None -> "NO SELECTION"
-   | Some s -> s
+   | Some node ->
+*) let node = !mathview#get_selection in
+      match Minidom.node_get_name node with
+        None   -> "selection is on nothing" 
+      | Some s -> "selection is on " ^ Minidom.string_of_mDOMString s
  in
   print_string ("get_selection: " ^ selection ^ "\n") ;
   flush stdout
-*) ()
 ;;
 
 let set_selection mathview () =
-(*
- let selection =
-  match !mathview#get_selection with
-     None -> "NO SELECTION"
-   | Some s -> s
- in
-  print_string ("get_selection: " ^ selection ^ "\n") ;
-  flush stdout
-*) ()
+ begin
+  try
+(*   match !mathview#get_selection with
+      None -> raise Not_found
+    | Some node ->
+*) let node = !mathview#get_selection in
+       match Minidom.node_get_parent node with
+          None -> raise Not_found
+        | Some node ->
+           !mathview#set_selection node ;
+           print_string "set_selection: SEEMS TO WORK\n"
+  with
+   Not_found ->
+    print_string "set_selection: YOU MUST PREVIOUSLY SELECT A NON-ROOT NODE" 
+ end ;
+ flush stdout
 ;;
 
 let unload mathview () =
@@ -225,7 +229,6 @@ let main_window = GWindow.window ~title:"GtkMathView test" () in
 let vbox = GPack.vbox ~packing:main_window#add () in
 let sw = GBin.scrolled_window ~width:50 ~height:50 ~packing:vbox#pack () in
 let mathview= ref (GMathView.math_view ~packing:sw#add ~width:50 ~height:50 ()) in
-(*let hbox = GPack.hbox ~packing:vbox#pack () in*)
 let table = GPack.table ~rows:5 ~columns:5 ~packing:vbox#pack () in
 let button_t1=GButton.button ~label:"activate t1 fonts" ~packing:(table#attach ~left:0 ~top:0) () in
 let button_load = GButton.button ~label:"load" ~packing:(table#attach ~left:1 ~top:0) () in