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