]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/lablgtkmathview/test/test.ml
Bug fixed in check_sort_elimination in the case (not tested so far)
[helm.git] / helm / DEVEL / lablgtkmathview / test / test.ml
index 3561c551c3be3a4512f926efc83840d95eff8ed2..d1821bfca13f1ae9990b42d33825846aca454ccb 100644 (file)
@@ -88,7 +88,7 @@ let selection_changed mathview (element : Gdome.element option) =
  flush stdout
 ;;
 
-let element_over mathview (element : Gdome.element option) _ =
+let element_over mathview ((element : Gdome.element option), _, _, _) =
  print_endline ("element_over: " ^
   (match element with
       None -> "element_over on nothing"
@@ -150,7 +150,7 @@ let rec action mathview (element : Gdome.element) =
        end
      | None -> assert false (* every element has a parent *)
 
-let click mathview (element : Gdome.element option) _ =
+let click mathview ((element : Gdome.element option), _, _, _) =
  let module G = Gdome in
   match element with
      None -> print_string "CLICKED ON NOTHING\n" ; flush stdout
@@ -177,7 +177,7 @@ let test_get_selection mathview () =
  let selection =
    match mathview#get_selection with
       Some element -> element#get_tagName#to_string
-    | None -> "no selection!"
+    | None -> "no selection! but there are " ^ (string_of_int (List.length mathview#get_selections)) ^ " multiple selections!"
  in
   print_string ("selection: " ^ selection ^ "\n") ;
   flush stdout
@@ -221,6 +221,25 @@ let test_reset_selections (mathview : GMathViewAux.multi_selection_math_view) ()
  mathview#set_selection None ;
  mathview#remove_selections
 
+let select_over (mathview : GMathViewAux.multi_selection_math_view) =
+  (fun (_,_,_,state) ->
+    let c = function
+      | `SHIFT    -> "shift"
+      | `LOCK     -> "lock"
+      | `CONTROL  -> "control"
+      | `MOD1     -> "mod1"
+      | _         -> ""
+    in
+    let msg =
+      String.concat ","
+        (List.filter (fun s -> s <> "")
+          (List.map c (Gdk.Convert.modifier state)))
+    in
+    if msg <> "" then begin
+      print_endline ("modifiers: " ^ msg);
+      flush stdout
+    end)
+
 let unload mathview () =
  mathview#unload ;
  print_string "unload: SEEMS TO WORK\n" ;
@@ -357,7 +376,9 @@ ignore(button_get_log_verbosity#connect#clicked (get_log_verbosity mathview)) ;
 ignore(mathview#connect#click (click mathview)) ;
 ignore(mathview#connect#selection_changed (selection_changed mathview));
 ignore(mathview#connect#element_over (element_over mathview)) ;
+ignore(mathview#connect#select_over (select_over mathview));
 ignore(button_load_dom#connect#clicked (load_doc mathview)) ;
+ignore(main_window#connect#destroy (fun _ -> GMain.quit ()));
 (* ignore(button_get_element_at#connect#clicked (get_element_at mathview)) ; *)
 (* Main Loop *)
 main_window#show () ;