aboutsummaryrefslogtreecommitdiff
path: root/Perl/t/test-no-crash.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Perl/t/test-no-crash.pl')
-rw-r--r--Perl/t/test-no-crash.pl230
1 files changed, 126 insertions, 104 deletions
diff --git a/Perl/t/test-no-crash.pl b/Perl/t/test-no-crash.pl
index beae1bf..b5d8f59 100644
--- a/Perl/t/test-no-crash.pl
+++ b/Perl/t/test-no-crash.pl
@@ -77,6 +77,7 @@ my ($text1, $text2, $text3, $text4);
my ($image1, $image2, $image3, $image4);
&creating_items ("unused");
+&verifying_item_completion;
sub creating_items {
# first removing all remaining items
@@ -97,9 +98,9 @@ sub creating_items {
$text3 = &test_eval (1, "add", 'text', 1, -position => [400,220], -text => "hello world3");
&test_eval (1, "add", 'window', 1);
# &test_eval (1, "add", 'track', 1, 5, -position => [100,200]);
- &test_eval (1, "add", 'track', 1, 5, -position => [100,200]);
- &test_eval (1, "add", 'waypoint', 1, 5, -position => [200,100]);
- &test_eval (1, "add", 'tabular', 1, 5, -position => [100,20]);
+ &test_eval (1, "add", 'track', 1, 5, -position => [100,200], -labelformat => $labelformat);
+ &test_eval (1, "add", 'waypoint', 1, 5, -position => [200,100], -labelformat => $labelformat);
+ &test_eval (1, "add", 'tabular', 1, 5, -position => [100,20], -labelformat => $labelformat);
&test_eval (1, "add", 'group', 1);
&test_eval (1, "mapinfo", 'mapinfo1', 'create');
@@ -126,6 +127,27 @@ sub creating_items {
&creating_datas; # some of the data are using items!
}
+# verifies that we create an item of every existing type
+sub verifying_item_completion {
+ my @all_types = $zinc->add(); ## this use of add is not documented yet XXX!
+ my @all_items = $zinc->find ('withtag', 'all');
+ my %created_item_types;
+ foreach my $item (@all_items) {
+ $created_item_types{$zinc->type($item)} = 1;
+ }
+ foreach my $type (@all_types) {
+ if (defined $created_item_types{$type}) {
+ delete $created_item_types{$type};
+ }
+ else {
+ &log(-100, "item type \"type\" which exist in Zinc is not tested!\n");
+ }
+ }
+ foreach my $type (sort keys %created_item_types) {
+ &log(-100, "This tested item type \"$type\" is supposed not to exist in Zinc!\n");
+ }
+}
+
my %options;
my %types;
@@ -172,108 +194,103 @@ my %typesNonStandardValues;
my %typesIllegalValues;
sub creating_datas {
- %typesValues =
- ('justify' => ['left', 'right', 'center'],
- 'alpha' => [0, 50, 100, 23],
- 'anchor' => ['n', 's', 'e', 'w', 'nw', 'ne', 'sw', 'se', 'center'],
- 'angle' => [0, 90, 180, 270, 360, 12, 93, 178, 272, 359],
-# 'autoalignment' => ['lll', 'llr', 'llc', 'lrl', 'lrr', 'lrc', 'lcl', 'lcr', 'lcc',
-# 'rll', 'rlr', 'rlc', 'rrl', 'rrr', 'rrc', 'rcl', 'rcr', 'rcc',
-# 'cll', 'clr', 'clc', 'crl', 'crr', 'crc', 'ccl', 'ccr', 'ccc',
-# '-',],
- 'autojustify' => ['lll', 'llr', 'llc', 'lrl', 'lrr', 'lrc', 'lcl', 'lcr', 'lcc',
- 'rll', 'rlr', 'rlc', 'rrl', 'rrr', 'rrc', 'rcl', 'rcr', 'rcc',
- 'cll', 'clr', 'clc', 'crl', 'crr', 'crc', 'ccl', 'ccr', 'ccc',
- '-',],
- 'boolean' => [0..1],
- 'border' => ['left', 'right', 'top', 'bottom', 'contour', 'oblique', 'counteroblique'], ## +combinations!
- 'pattern' => ['AlphaStipple0', 'AlphaStipple3', 'AlphaStipple14', 'AlphaStipple11', 'AlphaStipple7'], ####?!
- 'patterns' => [['AlphaStipple0', 'AlphaStipple3', 'AlphaStipple14', 'AlphaStipple11', 'AlphaStipple7'], ['AlphaStipple0']], ##TBC
- 'capstyle' => ['butt', 'projecting', 'round'],
- 'gradient' => ['green', 'LemonChiffon', '#c84', '#4488cc', '#888ccc444', 'red'], ## TBC
- 'gradients' => [['green'], ['LemonChiffon'], ['#c84'], ['#4488cc'], ['#888ccc444'],
- ['red', 'green'], ['red', 'green', 'blue'],
- ['red:50', 'green:50', 'blue:50'],
- ['blue:0', 'green:50', 'red:90'],
- ], ## TBC
- 'dimension' => [0..5, 10, 50, 100, 0.0, 5.5, 100.5, 4.5], ## and floats ?!
-# 'edgelist' => ['left', 'right', 'top', 'bottom', 'contour', 'oblique', 'counteroblique'], ## +combinations!
- 'font' => ['10x20', '6x10', '6x12', '6x13'],
- 'image' => [$image1, $image2, $image3], ## TBC
- 'integer' => [-10000, -100, -1, 0, 1, 10, 10000], ## pour quoi?
- 'item' => [$text1, $text2],
- 'joinstyle' => ['bevel', 'miter', 'round'],
- 'labelformat' => [
- "200x10", ## BUG BUG
+
+ %typesValues =
+ ('alignment' => ['left', 'right', 'center'],
+ 'alpha' => [0, 50, 100, 23],
+ 'anchor' => ['n', 's', 'e', 'w', 'nw', 'ne', 'sw', 'se', 'center'],
+ 'angle' => [0, 90, 180, 270, 360, 12, 93, 178, 272, 359],
+ 'autoalignment' => ['lll', 'llr', 'llc', 'lrl', 'lrr', 'lrc', 'lcl', 'lcr', 'lcc',
+ 'rll', 'rlr', 'rlc', 'rrl', 'rrr', 'rrc', 'rcl', 'rcr', 'rcc',
+ 'cll', 'clr', 'clc', 'crl', 'crr', 'crc', 'ccl', 'ccr', 'ccc',
+ '-',],
+ 'boolean' => [0..1],
+ 'bitmap' => ['AlphaStipple0', 'AlphaStipple3', 'AlphaStipple14', 'AlphaStipple11', 'AlphaStipple7'], ####?!
+ 'bitmaplist' => [['AlphaStipple0', 'AlphaStipple3', 'AlphaStipple14', 'AlphaStipple11', 'AlphaStipple7'], ['AlphaStipple0']], ##TBC
+ 'capstyle' => ['butt', 'projecting', 'round'],
+ 'gradient' => ['green', 'LemonChiffon', '#c84', '#4488cc', '#888ccc444', 'red'], ## TBC
+ 'gradientlist' => [['green'], ['LemonChiffon'], ['#c84'], ['#4488cc'], ['#888ccc444'],
+ ['red', 'green'], ['red', 'green', 'blue'],
+ ['red:50', 'green:50', 'blue:50'],
+ ['blue:0', 'green:50', 'red:90'],
+ ], ## TBC
+ 'dimension' => [0..5, 10, 50, 100, 0.0, 5.5, 100.5, 4.5], ## and floats ?!
+ 'edgelist' => ['left', 'right', 'top', 'bottom', 'contour', 'oblique', 'counteroblique'], ## +combinations!
+ 'font' => ['10x20', '6x10', '6x12', '6x13'],
+ 'image' => [$image1, $image2, $image3], ## TBC
+ 'integer' => [-10000, -100, -1, 0, 1, 10, 10000], ## pour quoi?
+ 'item' => [$text1, $text2],
+ 'joinstyle' => ['bevel', 'miter', 'round'],
+ 'labelformat' => ["200x10", ## BUG BUG
# "200x100 x100x20+0+0 x100x20+0+20 x200x40+100+20"
- ],
- 'leaderanchors' => ["%10x30", "|0|0", "%40x20", "|1|1", "|100|100", "%67x21" ], ## TBC! non exchaustif!! BUG non conforme à la doc
- # illegal et fait planter: "%50"
- 'lineend' => [ [10,10,10], [10,100,10], [100,10,10], [10,10,100], [100,10,100] ],
- 'lineshape' => ['straight', 'rightlightning', 'leftlightning', 'rightcorner', 'leftcorner', 'doublerightcorner', 'doubleleftcorner'],
- 'linestyle' => ['dotted', 'simple', 'dashed', 'mixed', 'dotted'],
- 'mapinfo' => ['mapinfo1','mapinfo2','mapinfo3'], ## TBC
- 'number' => [2.3, 1.0, 5.6, 2.1],
- 'point' => [ [0,0] , [10,10], [20,20], [30,30], [20,20], [0,0] , [10,10] ],
- 'priority' => [ 1, 10, 50, 1000, 10000 ], # positif ou nul
- 'relief' => ['flat', 'groove', 'raised', 'ridge', 'sunken',
- 'roundraised', 'roundsunken', 'roundgroove',
- 'roundridge', 'sunkenrule', 'raisedrule'],
- 'text' => ['teststring', 'short', 'veryverylongstring'],
- 'tags' => [ [1], [1..2], ['a','b'], ['tag1','tag2','tag3']],
- 'unsignedint' => [ 0..5 , 10, 20, 30, 100 ],
- 'window' => [], ## TBC
- );
-
+ ],
+ 'leaderanchors' => ["%10x30", "|0|0", "%40x20", "|1|1", "|100|100", "%67x21" ], ## TBC! non exchaustif!! BUG non conforme à la doc
+ # illegal et fait planter: "%50"
+ 'lineend' => [ [10,10,10], [10,100,10], [100,10,10], [10,10,100], [100,10,100] ],
+ 'lineshape' => ['straight', 'rightlightning', 'leftlightning', 'rightcorner', 'leftcorner', 'doublerightcorner', 'doubleleftcorner'],
+ 'linestyle' => ['dotted', 'simple', 'dashed', 'mixed', 'dotted'],
+ 'mapinfo' => ['mapinfo1','mapinfo2','mapinfo3'], ## TBC
+# 'number' => [2.3, 1.0, 5.6, 2.1],
+ 'point' => [ [0,0] , [10,10], [20,20], [30,30], [20,20], [0,0] , [10,10] ],
+ 'priority' => [ 1, 10, 50, 1000, 10000 ], # positif ou nul
+ 'relief' => ['flat', 'groove', 'raised', 'ridge', 'sunken',
+ 'roundraised', 'roundsunken', 'roundgroove',
+ 'roundridge', 'sunkenrule', 'raisedrule'],
+ 'string' => ['teststring', 'short', 'veryverylongstring'],
+ 'taglist' => [ [1], [1..2], ['a','b'], ['tag1','tag2','tag3']],
+ 'unsignedint' => [ 0..5 , 10, 20, 30, 100 ],
+ 'window' => [], ## TBC
+ );
+
# the following valid value associated to types should be all different from
# default value and from value initiated when creating items (see up...)
- %typesNonStandardValues =
- ('justify' => 'right',
- 'alpha' => 50,
- 'anchor' => 'w',
- 'angle' => 45,
- 'autoalignment' => 'llc',
- 'pattern' => 'AlphaStipple14',
- 'patterns' => ['AlphaStipple0', 'AlphaStipple3', 'AlphaStipple14', 'AlphaStipple11', 'AlphaStipple7'],
- 'capstyle' => 'butt',
- 'gradient' => 'LemonChiffon',
- 'gradients' => ['red:50', 'green:50', 'blue:50'],
- 'dimension' => 45,
- 'edgelist' => 'contour',
- 'font' => '6x10',
- 'image' => $image4,
- 'integer' => 7,
- 'item' => $text3,
- 'joinstyle' => 'miter',
- 'labelformat' => "200x30", ## BUG BUG
- 'leaderanchors' => "%10x45", ## BUG BUG
- 'lineend' => [13,7,20],
- 'lineshape' => 'rightlightning',
- 'linestyle' => 'dotted',
- 'mapinfo' => 'mapinfo2', ## TBC
- 'number' => 7.6,
- 'point' => [100,100],
- 'priority' => 50,
- 'relief' => 'groove',
- 'text' => 'notsoshort',
- 'tags' => ['tag1','tag11','tag111'],
- 'unsignedint' => 7, # 22, # 22 is to high for -visiblehistorysize and 5 is, the default value for reticle -period
- 'window' => undef, ### TBC
- );
+ %typesNonStandardValues =
+ ('alignment' => 'right',
+ 'alpha' => 50,
+ 'anchor' => 'w',
+ 'angle' => 45,
+ 'autoalignment' => 'llc',
+ 'bitmap' => 'AlphaStipple14',
+ 'bitmaplist' => ['AlphaStipple0', 'AlphaStipple3', 'AlphaStipple14', 'AlphaStipple11', 'AlphaStipple7'],
+ 'capstyle' => 'butt',
+ 'gradient' => 'LemonChiffon',
+ 'gradientlist' => ['red:50', 'green:50', 'blue:50'],
+ 'dimension' => 45,
+ 'edgelist' => 'contour',
+ 'font' => '6x10',
+ 'image' => $image4,
+ 'integer' => 7,
+ 'item' => $text3,
+ 'joinstyle' => 'miter',
+ 'labelformat' => "200x30", ## BUG BUG
+ 'leaderanchors' => "%10x45", ## BUG BUG
+ 'lineend' => [13,7,20],
+ 'lineshape' => 'rightlightning',
+ 'linestyle' => 'dotted',
+ 'mapinfo' => 'mapinfo2', ## TBC
+ 'number' => 7.6,
+ 'point' => [100,100],
+ 'priority' => 50,
+ 'relief' => 'groove',
+ 'string' => 'notsoshort',
+ 'taglist' => ['tag1','tag11','tag111'],
+ 'unsignedint' => 7, # 22, # 22 is to high for -visiblehistorysize and 5 is, the default value for reticle -period
+ 'window' => undef, ### TBC
+ );
- %typesIllegalValues =
- ('alpha' => [0..100],
- 'anchor' => ['n', 's', 'e', 'w'], ##TBC
- 'angle' => [0..360],
- 'boolean' => [0..1],
- 'capstyle' => [],
- 'dimension' => [0..100],
- 'font' => ['10x20', '6x10', '6x12', '6x13'],
- 'leaderanchors' => ["%50" ], ## TBC! non exchaustif!! BUG non
- 'relief' => ['flat', 'groove', 'raised', 'ridge', 'sunken',
- 'roundraised', 'roundsunken', 'roundgroove',
- 'roundridge', 'sunkenrule', 'raisedrule'],
- );
+ %typesIllegalValues =
+ ('alpha' => [0..100],
+ 'anchor' => ['n', 's', 'e', 'w'], ##TBC
+ 'angle' => [0..360],
+ 'boolean' => [0..1],
+ 'capstyle' => [],
+ 'dimension' => [0..100],
+ 'font' => ['10x20', '6x10', '6x12', '6x13'],
+ 'leaderanchors' => ["%50" ], ## TBC! non exchaustif!! BUG non
+ 'relief' => ['flat', 'groove', 'raised', 'ridge', 'sunken',
+ 'roundraised', 'roundsunken', 'roundgroove',
+ 'roundridge', 'sunkenrule', 'raisedrule'],
+ );
}
$mw->Button(-text => "Test options",
@@ -290,7 +307,7 @@ $mw->Button(-text => "Test fields attributes",
### print log information to the logfile
### if $level is <= than opt_log (def = 0) then print log on the stdout
-### - a loglevel of -100 means an error to be loggued with %%% prefix
+### - a loglevel of -100 means an error to be logged with %%% prefix
### - a loglevel of -10 means an error in the test (data missing?)
### - a loglevel of 0 means an message to be usually printed (and logged in any case)
### - a loglevel greater than 1 is for trace only
@@ -740,10 +757,15 @@ sub equal_arrays {
}
return 1;
}
-# &test_mapitems; # should be done before really testing map items attributes
-# &test_labelcontent; # should be done before really testing track/waypoint/tabular items attributes
+# #### &test_mapitems; # should be done before really testing map items attributes
+# #### &test_labelcontent; # should be done before really testing track/waypoint/tabular items attributes
&test_every_field_attributes;
&test_attributes; # on peut configurer toutes les attributs
&test_cloning; # le clonage fonctionne correctement !
+
+# #### &test_path_tags;
+# #### &test_illegal_tags;
+
+
MainLoop();