summaryrefslogtreecommitdiffstats
path: root/scilab/modules/graphics
diff options
context:
space:
mode:
authorClément DAVID <clement.david@scilab.org>2010-03-03 16:09:16 +0100
committerClément DAVID <clement.david@scilab.org>2010-03-03 16:09:16 +0100
commit8e2b33ddb0c46db4e4f3b02812b19e77d6e5dbaa (patch)
tree5eff5f2f3300834ca9974e7adebd78440c0142ae /scilab/modules/graphics
parent4364f83b4f38e8a6d6cc3fdd7201d603eb7ad31c (diff)
parent075f30cda0c6c4d7b1cd7cf4d2cdd4c67e4e6393 (diff)
downloadscilab-8e2b33ddb0c46db4e4f3b02812b19e77d6e5dbaa.zip
scilab-8e2b33ddb0c46db4e4f3b02812b19e77d6e5dbaa.tar.gz
Merge commit 'origin/5.2'
Conflicts: scilab/modules/xcos/src/java/org/scilab/modules/xcos/io/XcosCodec.java
Diffstat (limited to 'scilab/modules/graphics')
-rw-r--r--scilab/modules/graphics/macros/%h_load.sci1
-rw-r--r--scilab/modules/graphics/macros/%h_save.sci9
-rw-r--r--scilab/modules/graphics/macros/legend.sci5
-rw-r--r--scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref94
-rw-r--r--scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst26
5 files changed, 131 insertions, 4 deletions
diff --git a/scilab/modules/graphics/macros/%h_load.sci b/scilab/modules/graphics/macros/%h_load.sci
index 9080257..1937620 100644
--- a/scilab/modules/graphics/macros/%h_load.sci
+++ b/scilab/modules/graphics/macros/%h_load.sci
@@ -1451,6 +1451,7 @@ function links=get_links_from_path(ax,paths)
1451 links=[];ok=%t 1451 links=[];ok=%t
1452 for p=paths 1452 for p=paths
1453 e=ax; 1453 e=ax;
1454 p(1)=p(1)-1// the caption does not exists yet
1454 for kp=1:size(p,'*'), 1455 for kp=1:size(p,'*'),
1455 if or(e.type==['Axes','Compound'])&p(kp)<=size(e.children,'*') then 1456 if or(e.type==['Axes','Compound'])&p(kp)<=size(e.children,'*') then
1456 e=e.children(p(kp)), 1457 e=e.children(p(kp)),
diff --git a/scilab/modules/graphics/macros/%h_save.sci b/scilab/modules/graphics/macros/%h_save.sci
index d1823e0..774c4bb 100644
--- a/scilab/modules/graphics/macros/%h_save.sci
+++ b/scilab/modules/graphics/macros/%h_save.sci
@@ -706,15 +706,16 @@ function p=get_entity_path(e)
706// given a handle e on an entity this function returns its path relative 706// given a handle e on an entity this function returns its path relative
707// to its parent axes. 707// to its parent axes.
708// the path is a vector of child index. 708// the path is a vector of child index.
709 p=[]; 709 p=[];parent=e.parent;
710 while %t 710
711 parent=e.parent 711 while %t
712 pos=find(parent.children==e,1) 712 pos=find(parent.children==e,1)
713 if pos==[] then 713 if pos==[] then
714 error(msprintf(_("%s : Invalid entity %s\n"),"save","Legend")) 714 error(msprintf(_("%s : Invalid entity %s\n"),"save","Legend"))
715 end 715 end
716 p=[pos p] 716 p=[pos p]
717 if or(parent.type==['Axes' 'Figure']) then break,end 717 if parent.type=='Axes' then break,end
718 e=parent 718 e=parent
719 parent=e.parent;
719 end 720 end
720endfunction 721endfunction
diff --git a/scilab/modules/graphics/macros/legend.sci b/scilab/modules/graphics/macros/legend.sci
index 1586689..66471ea 100644
--- a/scilab/modules/graphics/macros/legend.sci
+++ b/scilab/modules/graphics/macros/legend.sci
@@ -86,6 +86,11 @@ options_codes=[1;2;3;
86 86
87 drawlater() 87 drawlater()
88 c=captions(H,leg) 88 c=captions(H,leg)
89 if options_codes(kopt)<0 then
90 c.background=f.background
91 else
92 c.background=Acur.background
93 end
89 if with_box then c.line_mode='on',else c.line_mode='off',end 94 if with_box then c.line_mode='on',else c.line_mode='off',end
90 c.legend_location=options_names(kopt) 95 c.legend_location=options_names(kopt)
91 if opt==5 then 96 if opt==5 then
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref
new file mode 100644
index 0000000..92c1d25
--- /dev/null
+++ b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.dia.ref
@@ -0,0 +1,94 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2006-2008 - INRIA - Serge.Steer@inria.fr
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- TEST WITH GRAPHIC -->
8// <-- Non-regression test for bug 6665 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=6665
12//
13// <-- Short Description -->
14//legend (caption) nor properly saved or loaded
15plot2d()
16legend(['a';'b';'c'])
17 ans =
18
19Handle of type "Legend" with properties:
20========================================
21parent: Axes
22children: []
23visible = "on"
24text = ["a";"b";"c"]
25font_style = 6
26font_size = 1
27font_color = -1
28fractional_font = "off"
29links = ["Polyline";"Polyline";"Polyline"]
30legend_location = "in_upper_right"
31position = [0.7491013,0.1332972]
32line_mode = "on"
33thickness = 1
34foreground = -1
35fill_mode = "on"
36background = -2
37clip_state = "off"
38clip_box = []
39user_data = []
40f=gcf()
41 f =
42
43Handle of type "Figure" with properties:
44========================================
45children: "Axes"
46figure_position = [200,200]
47figure_size = [624,596]
48axes_size = [612,461]
49auto_resize = "on"
50viewport = [0,0]
51figure_name = "Figure n°%d"
52figure_id = 0
53info_message = ""
54color_map= matrix 32x3
55pixmap = "off"
56pixel_drawing_mode = "copy"
57anti_aliasing = "off"
58immediate_drawing = "on"
59background = -2
60visible = "on"
61rotation_style = "unary"
62event_handler = ""
63event_handler_enable = "off"
64user_data = []
65tag = ""
66save(TMPDIR+'/foo.scg',f)
67clf()
68load(TMPDIR+'/foo.scg')
69if f.children.children(1).type<>'Legend' then bugmes();quit;end
70l=f.children.children(1)
71 l =
72
73Handle of type "Legend" with properties:
74========================================
75parent: Axes
76children: []
77visible = "on"
78text = ["a";"b";"c"]
79font_style = 6
80font_size = 1
81font_color = -1
82fractional_font = "off"
83links = ["Polyline";"Polyline";"Polyline"]
84legend_location = "in_upper_right"
85position = [0.7491013,0.1332972]
86line_mode = "on"
87thickness = 1
88foreground = -1
89fill_mode = "on"
90background = -2
91clip_state = "off"
92clip_box = []
93user_data = []
94if or(l.text<>['a';'b';'c']) then bugmes();quit;end
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst
new file mode 100644
index 0000000..8aecc47
--- /dev/null
+++ b/scilab/modules/graphics/tests/nonreg_tests/bug_6665.tst
@@ -0,0 +1,26 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2006-2008 - INRIA - Serge.Steer@inria.fr
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- TEST WITH GRAPHIC -->
9
10// <-- Non-regression test for bug 6665 -->
11//
12// <-- Bugzilla URL -->
13// http://bugzilla.scilab.org/show_bug.cgi?id=6665
14//
15// <-- Short Description -->
16//legend (caption) nor properly saved or loaded
17plot2d()
18legend(['a';'b';'c'])
19f=gcf()
20save(TMPDIR+'/foo.scg',f)
21clf()
22load(TMPDIR+'/foo.scg')
23if f.children.children(1).type<>'Legend' then pause,end
24l=f.children.children(1)
25if or(l.text<>['a';'b';'c']) then pause,end
26