## 22. Jul 2014 Andreas Weber ## A click-through test for graphics_toolkit fltk. ## You'll need zenity ("sudo apt-get install zenity" in debian/ubuntu) version_str = "Human driven FLTK test v0.0.1"; msg = "This script will guide you through some tests for the FLTK graphics toolkit which needs user invocation.\n\n\ It will ask you to confirm or refuse the proper function of the plotting commands.\n\ If you are dissatisfied with the result just edit the text in the info box and klick 'OK'.\n\ When finished it creates a diary which could be sent to XYZ for debugging."; system (sprintf('zenity --info --text="%s"', msg)); function show_question (title, msg) filename = tmpnam(); fid = fopen (filename, "w"); fprintf (fid, "%s", msg); fclose (fid); cmd = sprintf ('zenity --text-info --title="%s" --filename="%s" --editable', title, filename); pid = system (cmd, false, "async"); while (waitpid (pid, WNOHANG) != pid) ## keep the plot respondent __fltk_redraw__ (); usleep(1e5); endwhile unlink(filename); endfunction diary human_driven_fltk_test.diary graphics_toolkit fltk close all; sombrero (); msg = "\ A window with title 'Figure 1' and a neat 3D plot opens. You see a menubar \ with 'File' and 'Edit', a toolbar with 5 buttons 'A,G,P,R,?' and a statusbar, \ which shows the position when moving the mouse curser above the plot on the bottom right.\ \n\ Try to rotate the 3D plot by dragging with left mousebutton.\n\ Check if the menubar is respondent, enable and disable the grid with 'G'.\n\ Zoom in and out using the mousewheel, \ switch to pan mode with 'P' and see if panning works.\n\ After zooming in try Autoscale 'A'.\n\ If everything works as expected go ahead to the next test.\n"; show_question("Sombrero", msg); ## hide menubar set (gcf, "menubar", "none"); msg = "The menubar now is hidden and the figure window resized accordingly.\n"; show_question ("Hide menubar", msg); ## show menubar set (gcf, "menubar", "figure"); msg = "The menubar now is visible again like in the first test.\nWatch out! The figure will move its position in the next test."; show_question ("Show menubar", msg); ## move figure pos = get (gcf, "position"); pos(1) += 200; pos(2) -= 100; set(gcf, "position", pos); msg = "The figure has moved 200px to the right and 100px up.\nWe will double its size in the next step."; show_question("Move position", msg); ## set width and height of gcf pos = get (gcf, "position"); pos(3) *= 2; pos(4) *= 2; set(gcf, "position", pos); msg = "The figure has doubled its size."; show_question("Set width and height", msg); t=linspace(0,6*pi); plot(t, sin(t), ";sin;", t, cos(t), ";cos;") msg = "Now you see a 2D plot with a sin and a cos function plotted.\ Resize the window to your needs, try toggle grid, zoom and pan."; show_question("sin/cos 2D plot", msg); diary off