* Bug 16365 fixed: median(m,'r'|'c') was wrong after 5dc990
[scilab.git] / scilab / modules / graphics / tests / unit_tests / captions.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2008 - INRIA - Serge Steer
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- TEST WITH GRAPHIC -->
8 clf();a=gca();a.axes_visible="on";
9 xpoly([0 1],[1 1]/2);
10 e1=gce();
11 c=captions(e1,"test");
12 if or(c.text <> "test") then bugmes();quit;end
13 if or(c.links <> e1) then bugmes();quit;end
14 c2=captions(e1,"XXXX");
15 if or(c2.text <> "XXXX") then bugmes();quit;end
16 if size(a.children,"*") <>2 then bugmes();quit;end
17 e1.foreground=5;e1.thickness=3;
18 xpoly([0 1],0.2+[1 1]/2);
19 e2=gce();e2.mark_mode="on";e2.line_mode="off";e2.mark_style=3;
20 c=captions([e2,e1],["XXXX";"YYY"]);
21 if or(c.text <> ["XXXX";"YYY"]) then bugmes();quit;end
22 if or(c.links <> [e2,e1]) then bugmes();quit;end
23 c=captions([],[]);
24 if c<>[]  then bugmes();quit;end
25 if execstr("captions([e1],[''XXXX'';''YYY''])","errcatch")==0 then bugmes();quit;end
26 if execstr("captions([e1,e2],[''XXXX''])","errcatch")==0 then bugmes();quit;end
27 if execstr("captions(e1,[])","errcatch")==0 then bugmes();quit;end
28 //following tests should be visual
29 clf();a=gca();a.axes_visible="on";a.box="on";a.margins(4)=0.35;
30 E=[];
31 for y= 0:0.1:1
32     xpoly([0 1],[1 1]*y);
33     e=gce();e.foreground=10*y;
34     E=[e E];
35 end
36 c=captions(E,string( 0:0.1:1));
37 sleep(2000)
38 clf();a=gca();a.axes_visible="on";a.box="on";
39 xpoly([0 1],[1 1]/2);
40 c=captions(gce(),"test");
41 //test of different possible locations
42 clf();f=gcf();
43 x=[0:0.1:2*%pi]';
44 plot2d(x,[sin(x) sin(2*x) sin(3*x)],[1 -2 3])
45 E=get(gce(),"children");
46 E(1).thickness=3;
47 E(2).mark_size_unit="point";E(2).mark_size=2;
48 a=gca();a.box="on";a.margins(2)=0.3;a.margins(1)=0.25;
49 c=captions(E,["sin(x)" "sin(2*x)" "sin(3*x)"]);
50 c.fill_mode="on";c.background=2;
51 locations=["upper_left","upper_right","lower_right","lower_left"];
52 locations=["in_"+locations "out_"+locations "lower_caption" "upper_caption"];
53 for l=locations;
54     c.legend_location=l;
55     sleep(2000)
56 end
57 c.legend_location="by_coordinates";c.position=[0.5 1/8];
58 sleep(2000)
59 // captions with paches
60 clf();a=gca();
61 a.data_bounds=[-1 -1;2 2];a.axes_visible="on";
62 x=[0:0.1:2*%pi]';
63 xpoly(cos(x),sin(x))
64 E=gce();
65 xpoly(1+0.3*cos(x),1+0.3*sin(x))
66 E=[gce(), E];
67 xpoly(1.5+0.1*cos(x),1.5+0.1*sin(x))
68 E=[gce(), E];
69 for k=1:3
70     E(4-k).foreground=k;
71     E(4-k).background=k+1;
72     E(4-k).fill_mode="on";
73     E(4-k).closed="on";
74 end
75 E(3).thickness=3;
76 c=captions(E,["A" "B" "C"]);
77 c.legend_location="in_upper_right";