0025624: Visualization - selection is incorrect in perspective mode in a specific...
[occt.git] / tests / xml / begin
1 pload TOPTEST
2 pload DCAF
3
4 cpulimit 300
5
6 set ValidatorCheck 0
7
8 if { [info exists env(CSF_ValidatorPath)] != 0 } {
9     if {[file exists $env(CSF_ValidatorPath)]} {
10         set ValidatorCheck 1
11         set Validator $env(CSF_ValidatorPath)
12     }
13 }
14
15 if { [info exists imagedir] == 0 } {
16     set imagedir .
17 }
18
19 if { [info exists test_image ] == 0 } {
20     set test_image photo
21 }
22
23 set WorkDirectory $imagedir
24
25 set os "ALL"
26 if {[array get env os_type] != ""} {
27     set os $env(os_type)
28 }
29
30 if { [regexp "indows" $os] } {
31     if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
32         set Java "java"
33     } else {
34         puts "Warning: environment variable PATH doesn't contain path to Java"
35     }
36 } else {
37     catch {set Java $env(JAVAHOME)/bin/java}
38 }
39
40 set SchemaFile    ""
41
42 proc SaveToFile { aD aFile } {
43     upvar $aD D 
44     global FileSuffix ValidatorCheck
45     catch {[file delete ${aFile}]}
46     SaveAs D $aFile
47     if { [file exists $aFile] } {
48         if { $FileSuffix == "xml" && $ValidatorCheck} {
49             ValidateXml $aFile
50         } else {
51             puts "Validation of XML file by XSD schema is not provided."
52         }
53     } else {
54         puts "Error : There is no ${aFile} file"
55     }
56     catch {[file attributes ${aFile} -permissions 0777]}
57 }
58
59 proc ValidateXml { aFile } {
60     global Validator Java SchemaFile 
61     if { ![info exists Java] } {
62         puts "Error : Java is not exists"
63         return
64     }
65     set isValidInfo ""
66     set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
67     set isValid [catch {set isValidInfo [eval $ValCommand]}]
68     puts $isValidInfo
69     if { ![regexp "the document is valid" ${isValidInfo}] } {
70         puts "Error : File is not valid"
71     }
72 }