pload TOPTEST
pload VISUALIZATION
pload XDE
pload QAcommands
pload DCAF

set Test "TNaming_Builder test"
set IsDone 1
set TestError ""

puts "Creating document"
NewDocument D MDTV-Standard
set TestLab 0:1

#################### PRIMITIVE EVOLUTION ####################
box b 100 200 300

explode b E
if {[catch {BuildNamedShape D $TestLab:1 PRIMITIVE b}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build solid as primitive"
}
if {[catch {BuildNamedShape D [set TestLab]:1:1 PRIMITIVE b_1}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build edge as alone primitive"
}
if {[catch {BuildNamedShape D [set TestLab]:1:1 PRIMITIVE b_1 b_2 b_3}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build several edges as primitive over the old one"
}
if {[catch {BuildNamedShape D [set TestLab]:1:2 PRIMITIVE b_4 b_5 b_6}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build several edges as primitive"
}


#################### GENERATED EVOLUTION ####################
box b2 200 300 400
explode b2 F
if {[catch {BuildNamedShape D $TestLab:2 GENERATED b b2}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build solid as generation"
}
if {[catch {BuildNamedShape D [set TestLab]:2:1 GENERATED b_1 b2_1}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build face as alone generation"
}
if {[catch {BuildNamedShape D [set TestLab]:2:2 GENERATED b_2 b2_2 b_2 b2_3 b_3 b2_4}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build face as generation n:m"
}
if {[catch {BuildNamedShape D [set TestLab]:2:1 GENERATED b_3 b2_1 b_3 b2_3 b_4 b2_4}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build face as generation n:m to the exists named shape"
}

#################### MODIFY EVOLUTION ####################
box b3 300 400 500
explode b3 F
if {[catch {BuildNamedShape D $TestLab:3 MODIFY b2 b3}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build solid as modification"
}
if {[catch {BuildNamedShape D [set TestLab]:3:1 MODIFY b2_1 b3_1}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build face as alone modification"
}
if {[catch {BuildNamedShape D [set TestLab]:3:2 MODIFY b2_5 b3_2 b2_2 b3_3 b2_3 b3_4}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build face as modification n:m"
}
if {[catch {BuildNamedShape D [set TestLab]:3:1 MODIFY b2_3 b3_1 b_3 b3_3 b2_4 b3_4}] == 1} {
	set IsDone 0
	set TestError "$TestError # Can't build face as modification n:m to the exists named shape"
}

pload INSPECTOR
tinspector -select 0:1:3:2 TNaming_NamedShape
