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
78
79
80
81
82
83
84
85
86
|
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2015 - Scilab Enterprises - Charlotte HECQUET - Calixte DENIZET
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
//
// <-- TEST WITH GRAPHIC -->
//
// <-- Short Description -->
// Unit test for fec function
//
// First test: quadrangles+mesh
a = [1 1;
2 1;
2 2;
1 2]
a =
1. 1.
2. 1.
2. 2.
1. 2.
x = a(:,1);
y = a(:,2);
triangle = [1 1 2 3 4 0];
clf();
f=gcf();
f.color_map=jetcolormap(12);
func = rand(4,1);
fec(x,y,triangle,func,mesh=%t);
assert_checkequal(f.children(1).children(1).children.data, [a func]);
assert_checkequal(f.children(1).children(1).children.triangles, triangle);
assert_checkequal(f.children(1).children(1).children.line_mode , "on");
assert_checkequal(f.children(1).children(1).children.z_bounds, [0 0]);
assert_checkequal(f.children(1).children(1).children.color_range, [0 0]);
assert_checkequal(f.children(1).children(1).children.outside_colors, [0 0]);
// Second test: quadrangles without mesh
clf();
f=gcf();
func = rand(4,1);
f.color_map=jetcolormap(12);
fec(x,y,triangle,func,mesh=%f);
assert_checkequal(f.children(1).children(1).children.data, [a func]);
assert_checkequal(f.children(1).children(1).children.triangles, triangle);
assert_checkequal(f.children(1).children(1).children.line_mode , "off");
assert_checkequal(f.children(1).children(1).children.z_bounds, [0 0]);
assert_checkequal(f.children(1).children(1).children.color_range, [0 0]);
assert_checkequal(f.children(1).children(1).children.outside_colors, [0 0]);
// Third test: quadrangles+[zmin zmax]
clf();
f=gcf();
func = rand(4,1);
f.color_map=jetcolormap(12);
fec(x,y,triangle,func,zminmax=[0.25 0.5]);
assert_checkequal(f.children(1).children(1).children.data, [a func]);
assert_checkequal(f.children(1).children(1).children.triangles, triangle);
assert_checkequal(f.children(1).children(1).children.line_mode , "off");
assert_checkequal(f.children(1).children(1).children.z_bounds, [0.25 0.5]);
assert_checkequal(f.children(1).children(1).children.color_range, [0 0]);
assert_checkequal(f.children(1).children(1).children.outside_colors, [0 0]);
// Forth test: quadrangles+colminmax
clf();
f=gcf();
func = rand(4,1);
f.color_map=jetcolormap(12);
fec(x,y,triangle,func,colminmax=[1 6]);
assert_checkequal(f.children(1).children(1).children.data, [a func]);
assert_checkequal(f.children(1).children(1).children.triangles, triangle);
assert_checkequal(f.children(1).children(1).children.line_mode , "off");
assert_checkequal(f.children(1).children(1).children.z_bounds, [0 0]);
assert_checkequal(f.children(1).children(1).children.color_range, [1 6]);
assert_checkequal(f.children(1).children(1).children.outside_colors, [0 0]);
// Fifth test: quadrangles+zminmax+colout
clf();
f=gcf();
func = rand(4,1);
f.color_map=jetcolormap(12);
fec(x,y,triangle,func,zminmax=[0.25 0.75], colout=[0 0]);
assert_checkequal(f.children(1).children(1).children.data, [a func]);
assert_checkequal(f.children(1).children(1).children.triangles, triangle);
assert_checkequal(f.children(1).children(1).children.line_mode , "off");
assert_checkequal(f.children(1).children(1).children.z_bounds, [0.25 0.75]);
assert_checkequal(f.children(1).children(1).children.color_range, [0 0]);
assert_checkequal(f.children(1).children(1).children.outside_colors, [-1 -1]);
close();
|