1
1
import { httpRequest , create , openFile , treeDraw , build3d } from 'jsroot' ;
2
2
3
- async function test3d ( obj , opt , title ) {
3
+ async function test3d ( obj , opt , title , json_reflength = - 1 ) {
4
4
if ( ! obj ) {
5
5
console . error ( `No object provided for ${ title } ` ) ;
6
6
return null ;
@@ -13,7 +13,15 @@ async function test3d(obj, opt, title) {
13
13
return null ;
14
14
}
15
15
16
- console . log ( `${ title } Ok` ) ;
16
+ if ( json_reflength <= 0 )
17
+ console . log ( `${ title } Ok` ) ;
18
+ else {
19
+ let json = JSON . stringify ( obj3d . toJSON ( ) ) ;
20
+ if ( Math . abs ( json . length - json_reflength ) / json_reflength > 0.01 )
21
+ console . error ( `${ title } FAILURE json ${ json . length } too much differ from refernce ${ json_reflength } ` ) ;
22
+ else
23
+ console . log ( `${ title } OK json ${ json . length } ` ) ;
24
+ }
17
25
18
26
return obj3d ;
19
27
}
@@ -26,19 +34,19 @@ let server = 'https://root.cern/js/files/',
26
34
let file = await openFile ( filename ) ;
27
35
let hist2 = await file . readObject ( 'hpxpy' ) ;
28
36
29
- await test3d ( hist2 , 'lego2' , 'TH2 lego plot' ) ;
37
+ await test3d ( hist2 , 'lego2' , 'TH2 lego plot' , 6916869 ) ;
30
38
31
39
let tuple = await file . readObject ( 'ntuple' ) ;
32
40
let hist3 = await treeDraw ( tuple , 'px:py:pz;hbins:15' ) ;
33
41
34
- await test3d ( hist3 , 'box3' , 'TH3 box plot' ) ;
42
+ await test3d ( hist3 , 'box3' , 'TH3 box plot' , 4223457 ) ;
35
43
36
44
let hist1 = await file . readObject ( 'hpx' ) ;
37
45
38
- await test3d ( hist1 , 'lego2' , 'TH1 lego plot' ) ;
46
+ await test3d ( hist1 , 'lego2' , 'TH1 lego plot' , 3332953 ) ;
39
47
40
48
let geom = await httpRequest ( filename3 , 'object' ) ;
41
- await test3d ( geom , '' , 'Geometry build' ) ;
49
+ await test3d ( geom , '' , 'Geometry build' , 1811230 ) ;
42
50
43
51
let file2 = await openFile ( filename2 ) ;
44
52
let gr2 = await file2 . readObject ( 'Graph2D' ) ;
@@ -51,4 +59,4 @@ latex.fTextAlign = 22;
51
59
latex . fTextColor = 3 ;
52
60
latex . fTextSize = 10 ;
53
61
54
- await test3d ( latex , '' , 'TLatex drawing' ) ;
62
+ await test3d ( latex , '' , 'TLatex drawing' , 457275 ) ;
0 commit comments