add property layout_options in figure and uicontrol handles
[scilab.git] / scilab / modules / graphics / tests / unit_tests / layout.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 // <-- TEST WITH GRAPHIC -->
8 function fig = createFigure(layout)
9     fig = scf();
10     fig.layout = layout;
11     fig.toolbar_visible = "off";
12     fig.menubar_visible = "off";
13     fig.infobar_visible = "off";
14 endfunction
15 //constraints
16 //no border
17 createFigure("none");
18 c = createConstraints("nolayout");
19 u = uicontrol("constraints", c);
20 assert_checkequal(u.constraints, c);
21 delete(gcf());
22 //border layout
23 createFigure("border");
24 c = createConstraints("border", "center");
25 u = uicontrol("constraints", c, "string", "center");
26 assert_checkequal(u.constraints, c);
27 c = createConstraints("border", "left");
28 u = uicontrol("constraints", c, "string", "left");
29 assert_checkequal(u.constraints, c);
30 c = createConstraints("border", "right");
31 u = uicontrol("constraints", c, "string", "right");
32 assert_checkequal(u.constraints, c);
33 c = createConstraints("border", "top");
34 u = uicontrol("constraints", c, "string", "top");
35 assert_checkequal(u.constraints, c);
36 c = createConstraints("border", "bottom");
37 u = uicontrol("constraints", c, "string", "bottom");
38 assert_checkequal(u.constraints, c);
39 delete(gcf());
40 //grid layout
41 createFigure("grid");
42 c = createConstraints("grid");
43 u = uicontrol("constraints", c);
44 assert_checkequal(u.constraints, c);
45 delete(gcf());
46 //gridbag layout
47 createFigure("gridbag");
48 c = createConstraints("gridbag", [1 2 3 4]);
49 u = uicontrol("constraints", c);
50 assert_checkequal(u.constraints, c);
51 c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1]);
52 u = uicontrol("constraints", c);
53 assert_checkequal(u.constraints, c);
54 c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both");
55 u = uicontrol("constraints", c);
56 assert_checkequal(u.constraints, c);
57 c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both", "lower_left");
58 u = uicontrol("constraints", c);
59 assert_checkequal(u.constraints, c);
60 c = createConstraints("gridbag", [1 2 3 4], [1.1 2.1], "both", "lower_left", [10 20]);
61 u = uicontrol("constraints", c);
62 assert_checkequal(u.constraints, c);
63 delete(gcf());
64 // options
65 createFigure("none");
66 f = gcf();
67 assert_checkequal(f.layout_options, createLayoutOptions("nolayout"));
68 f.layout_options = createLayoutOptions("none");
69 assert_checkequal(f.layout_options, createLayoutOptions("none"));
70 delete(gcf());
71 createFigure("gridbag");
72 f = gcf();
73 assert_checkequal(f.layout_options, createLayoutOptions("gridbag"));
74 f.layout_options = createLayoutOptions("gridbag");
75 assert_checkequal(f.layout_options, createLayoutOptions("gridbag"));
76 delete(gcf());
77 createFigure("border");
78 f = gcf();
79 assert_checkequal(f.layout_options, createLayoutOptions("border"));
80 f.layout_options = createLayoutOptions("border", [10,20]);
81 assert_checkequal(f.layout_options, createLayoutOptions("border", [10,20]));
82 delete(gcf());
83 createFigure("grid");
84 f = gcf();
85 assert_checkequal(f.layout_options, createLayoutOptions("grid"));
86 f.layout_options = createLayoutOptions("grid", [30,40]);
87 assert_checkequal(f.layout_options, createLayoutOptions("grid", [30,40]));
88 f.layout_options = createLayoutOptions("grid", [10,20], [30,40]);
89 assert_checkequal(f.layout_options, createLayoutOptions("grid", [10,20], [30,40]));
90 delete(gcf());