annotate _test/Test/DOM/Node.pm @ 125:a4b0a819bbda

Small fixes in IMPL::DOM::Schema
author wizard
date Thu, 10 Jun 2010 17:43:51 +0400
parents e30bdd040fe3
children e6447ad85cb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
1 package Test::DOM::Node;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
5 use base qw(IMPL::Test::Unit);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
6 use IMPL::Test qw(test shared failed cmparray);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
7 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
8
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
9 require IMPL::DOM::Node;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
10
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
11 __PACKAGE__->PassThroughArgs;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
13 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
14 shared public property Root => prop_all;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
15 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
16
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
17 test Create => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
18 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
19
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
20 $this->Root(new IMPL::DOM::Document(nodeName => 'Root')) or failed "Failed to create a document";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
21 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
22
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
23 test InsertNode => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
24 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
25 my $child = $this->Root->insertNode(new IMPL::DOM::Node(nodeName => 'Child')) or failed "Failed to insert a child node";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
26 failed "fiestChild returned incorrect results" unless ($this->Root->firstChild || 0) == $child;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
27 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
28
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
29 test AppendNode => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
30 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
31
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
32 my $child = $this->Root->appendNode(new IMPL::DOM::Node(nodeName => 'Child')) or failed "Failed to append a child node";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
33
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
34 my $lastChild = $this->Root->removeLast;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
35
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
36 failed "removeLast returned incorrect results" unless $lastChild == $child;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
37 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
38
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
39 test GetDocumentNode => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
40 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
41
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
42 my $child = $this->Root->firstChild->appendNode(new IMPL::DOM::Node(nodeName => 'GrandChild')) or failed "Failed to append a child node";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
43
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
44 failed "document property is undef" unless $child->document;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
45 failed "document property returned incorrect value" unless $child->document == $this->Root;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
46 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
47
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
48 test MoveNode => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
49 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
50
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
51 my $grandChild = $this->Root->firstChild->firstChild;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
52 $this->Root->appendNode($grandChild);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
53
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
54 failed "incorrect new parentNode value" unless ($grandChild->parentNode || 0) == $this->Root;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
55 failed "incorrect new document value" unless ($grandChild->document || 0) == $this->Root;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
56 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
57
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
58 test AppendRange => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
59 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
60
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
61 my $count = $this->Root->childNodes->Count;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
62
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
63 $this->Root->appendRange(
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
64 map IMPL::DOM::Node->new(nodeName => "Item", nodeValue => $_),1..10
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
65 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
66
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
67 failed
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
68 "Wrong number of a child nodes",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
69 "Expected: ".($count+10),
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
70 "Actual: ".$this->Root->childNodes->Count
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
71 unless $count + 10 == $this->Root->childNodes->Count;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
72 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
73
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
74 test SelectNodes => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
75 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
76
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
77 my @result = $this->Root->selectNodes("Item");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
78
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
79 failed
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
80 "Wrong number of a selected nodes",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
81 "Expected: 10",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
82 "Actual: ".scalar(@result)
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
83 unless @result == 10;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
84 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
85
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
86 test SelectNodesByQuery => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
87 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
88
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
89 my @result = $this->Root->selectNodes(sub { $_->nodeName =~ /child/i } );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
90 failed
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
91 "Wrong number of a selected nodes",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
92 "Expected: 2",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
93 "Actual: ".scalar(@result)
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
94 unless @result == 2;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
95 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
96
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
97 test CheckNodesValues => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
98 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
99
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
100 my @expected = (1..10);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
101
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
102 my @result = map $_->nodeValue, grep $_->nodeValue, $this->Root->selectNodes("Item");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
103
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
104 failed
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
105 "Some nodes returned wrong node values or in a wrong order",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
106 "Expected: ".join(', ',@expected),
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
107 "Recieved: ".join(', ',@result)
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
108 unless cmparray(\@expected,\@result);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
109
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
110 failed
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
111 "a text property of a root node returned a wrong value",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
112 "Expected: @expected",
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
113 "Recieved: ". $this->Root->text
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
114 unless $this->Root->text eq join '',@expected;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
115 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
116
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
117 test isComplex => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
118 my ($this) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
119
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
120 failed "property isComplex returned false for the root node" unless $this->Root->isComplex;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
121 failed "property isComplex returned true for a simple node", $this->Root->firstChild->nodeName if $this->Root->firstChild->isComplex;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
122 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
123
123
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
124 test setObjectProperty => sub {
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
125 my ($this) = @_;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
126
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
127 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
128
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
129 my $name = 'Vergon 6';
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
130
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
131 $node->nodeProperty(name => $name);
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
132 failed "Failed to set a property 'name'", "Expected: $name", "Got: ".$node->name unless $node->name eq $name;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
133
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
134 $name = 'entity_vergon_6';
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
135 $node->systemName($name);
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
136 failed "Failed to set a property 'systemName'", "Expected: $name", "Got: ".$node->nodeProperty('systemName') unless $node->nodeProperty('systemName') eq $name;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
137 };
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
138
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
139 test setDynamicProperty => sub {
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
140 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
141
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
142 my $uuid = 'entity_76fd98b9e7a';
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
143 $node->nodeProperty(uuid => $uuid);
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
144 failed "Failed to set a dynamic property 'uuid'", "Expected: $uuid", "Got: ".$node->nodeProperty('uuid') unless $node->nodeProperty('uuid') eq $uuid;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
145 };
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
146
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
147 test setPrivateProperty => sub {
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
148 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
149
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
150 eval {
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
151 $node->nodeProperty(_private => 'failed');
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
152 1;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
153 } and failed "Setting a private property successfull";
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
154 };
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
155
124
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
156 test createNodeWithProps => sub {
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
157 my $uuid = 'entity_76fd98b9e7a';
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
158 my $name = 'Vergon 6';
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
159 my $systemName = 'entity_vergon_6';
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
160
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
161 my $node = Test::DOM::TypedNode->new(
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
162 nodeName => 'TestNode',
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
163 uuid => $uuid,
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
164 name => $name,
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
165 systemName => $systemName
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
166 );
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
167
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
168 failed "Failed to get dynamic property 'uuid'" unless $node->nodeProperty('uuid') eq $uuid;
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
169 failed "Failed to get property 'name' through nodeProperty method" unless $node->nodeProperty('name') eq $name;
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
170 failed "Failed to get property name directly" unless $node->name eq $name;
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
171 };
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
172
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
173 test listNodePredefinedProps => sub {
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
174 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
175
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
176 my @props = $node->listProperties;
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
177 my @expected = qw(name _private);
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
178
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
179 failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
180 };
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
181
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
182 test listNodeAllProps => sub {
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
183 my $node = Test::DOM::TypedNode->new(
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
184 nodeName => 'TestNode',
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
185 uuid => 'ade58f98b', # dynamic
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
186 name => 'noname', # predefined
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
187 systemName => 'no sys' # not visible to DOM
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
188 );
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
189
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
190 my @props = $node->listProperties;
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
191 my @expected = qw(name _private uuid); # systemName is not a DOM prop
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
192
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
193 failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
194 };
e30bdd040fe3 IMPL::Web::TT::Form concept
wizard
parents: 123
diff changeset
195
122
a7efb3117295 Fixed bug in IMPL::DOM::Navigator::selectNodes
wizard
parents: 49
diff changeset
196 package Test::DOM::TypedNode;
a7efb3117295 Fixed bug in IMPL::DOM::Navigator::selectNodes
wizard
parents: 49
diff changeset
197 use base qw(IMPL::DOM::Node);
a7efb3117295 Fixed bug in IMPL::DOM::Navigator::selectNodes
wizard
parents: 49
diff changeset
198 use IMPL::Class::Property;
123
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
199 use IMPL::DOM::Property qw(_dom);
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
200
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
201 __PACKAGE__->PassThroughArgs;
122
a7efb3117295 Fixed bug in IMPL::DOM::Navigator::selectNodes
wizard
parents: 49
diff changeset
202
123
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
203 BEGIN {
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
204 public _dom property name => prop_all;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
205 public property systemName => prop_all;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
206 private _dom property _private => prop_all;
1d7e370a91fa Additional DOM::Node tests
wizard
parents: 122
diff changeset
207 }
122
a7efb3117295 Fixed bug in IMPL::DOM::Navigator::selectNodes
wizard
parents: 49
diff changeset
208
a7efb3117295 Fixed bug in IMPL::DOM::Navigator::selectNodes
wizard
parents: 49
diff changeset
209
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 37
diff changeset
210 1;