1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - INRIA - Serge Steer <serge.steer@inria.fr>
4//
5//  This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- Non-regression test for bug 7509 -->
8//
9// <-- Bugzilla URL -->
10// http://bugzilla.scilab.org/show_bug.cgi?id=7509
11//
12// <-- Short Description -->
13// the legend help page does not correspond any more with the function (pos argument)
14//
15t=linspace(0,%pi,20);
16drawlater()
17clf();plot2d(t,[cos(t'),cos(2*t'),cos(3*t')],[-5,2 3]);
18ax=gca();
19C=ax.children.children;
20hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)']);
21if hl.legend_location <> "in_upper_right" then bugmes();quit;end
22if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
23delete(hl)
24hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)'],2);
25if hl.legend_location <> "in_upper_left" then bugmes();quit;end
26if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
27delete(hl)
28hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)'],"in_lower_right");
29if hl.legend_location <> "in_lower_right" then bugmes();quit;end
30if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
31delete(hl)
32hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)'],[2 0]);
33if hl.legend_location <> "by_coordinates" then bugmes();quit;end
34if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
35hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)'],%f);
36if hl.legend_location <> "in_upper_right" then bugmes();quit;end
37if hl.line_mode <> "off" then bugmes();quit;end
38if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
39delete(hl)
40hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)'],2,%f);
41if hl.legend_location <> "in_upper_left" then bugmes();quit;end
42if hl.line_mode <> "off" then bugmes();quit;end
43if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
44delete(hl)
45hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)'],"in_lower_right",%f);
46if hl.legend_location <> "in_lower_right" then bugmes();quit;end
47if hl.line_mode <> "off" then bugmes();quit;end
48if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
49delete(hl)
50hl=legend(['cos(t)';'cos(2*t)';'cos(3*t)'],[2 0],%f);
51if hl.legend_location <> "by_coordinates" then bugmes();quit;end
52if hl.line_mode <> "off" then bugmes();quit;end
53if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
54hl=legend('cos(t)','cos(2*t)','cos(3*t)');
55if hl.legend_location <> "in_upper_right" then bugmes();quit;end
56if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
57delete(hl)
58hl=legend('cos(t)','cos(2*t)','cos(3*t)',2,%f);
59if hl.legend_location <> "in_upper_left" then bugmes();quit;end
60if hl.line_mode <> "off" then bugmes();quit;end
61if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
62delete(hl)
63hl=legend('cos(t)','cos(2*t)','cos(3*t)',"in_lower_right",%f);
64if hl.legend_location <> "in_lower_right" then bugmes();quit;end
65if hl.line_mode <> "off" then bugmes();quit;end
66if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
67delete(hl)
68hl=legend('cos(t)','cos(2*t)','cos(3*t)',[2 0],%f);
69if hl.legend_location <> "by_coordinates" then bugmes();quit;end
70if hl.line_mode <> "off" then bugmes();quit;end
71if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
72hl=legend(C(1),C(2),C(3),['cos(t)';'cos(2*t)';'cos(3*t)']);
73if hl.legend_location <> "in_upper_right" then bugmes();quit;end
74if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
75delete(hl)
76hl=legend(C(1),C(2),C(3),'cos(t)','cos(2*t)','cos(3*t)',2);
77if hl.legend_location <> "in_upper_left" then bugmes();quit;end
78if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
79delete(hl)
80hl=legend(C,['cos(t)';'cos(2*t)';'cos(3*t)'],"in_lower_right");
81if hl.legend_location <> "in_lower_right" then bugmes();quit;end
82if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
83delete(hl)
84hl=legend(C,'cos(t)','cos(2*t)','cos(3*t)',[2 0]);
85if hl.legend_location <> "by_coordinates" then bugmes();quit;end
86if or(hl.text<>["cos(t)";"cos(2*t)";"cos(3*t)"]) then bugmes();quit;end
87