Logo ROOT   6.14/05
Reference Guide
fitpanel_playback.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_fit
3 /// This file will test all the transient frames (aka Dialog windows)
4 /// displayed in the fitpanel, as the rest of the functionality is
5 /// tried automatically with the UnitTest.C unit.
6 ///
7 /// This implies trying the Set Parameters dialog and the Advanced one.
8 ///
9 /// At every operation, a png file will be saved. These files will be
10 /// later on compared with some references values, to have an estimation
11 /// of the goodness of the test.
12 ///
13 /// \macro_code
14 ///
15 /// \author David Gonzalez Maline
16 
17 #include "TSystem.h"
18 #include "TSystemFile.h"
19 #include "TRecorder.h"
20 #include "Riostream.h"
21 
22 Int_t file_size(char *filename)
23 {
24  FileStat_t fs;
25  gSystem->GetPathInfo(filename, fs);
26  return (Int_t)fs.fSize;
27 }
28 
29 void fitpanel_playback()
30 {
31  r = new TRecorder();
32  r->Replay("http://root.cern.ch/files/fitpanel_playback.root");
33 
34  // wait for the recorder to finish the replay
35  while (r->GetState() == TRecorder::kReplaying) {
37  gSystem->Sleep(1);
38  }
39 
40  Int_t Step_Err = 100;
41  Int_t Step1_Ref = 15691;
42  Int_t Step2_Ref = 15691;
43  Int_t Step3_Ref = 17632;
44  Int_t Step4_Ref = 12305;
45  Int_t Step5_Ref = 11668;
46 
47  Int_t Step1_Size = file_size("Step1.png");
48  Int_t Step2_Size = file_size("Step2.png");
49  Int_t Step3_Size = file_size("Step3.png");
50  Int_t Step4_Size = file_size("Step4.png");
51  Int_t Step5_Size = file_size("Step5.png");
52 
53 
54  cout << "**********************************************************************" <<endl;
55  cout << "* Report of fitpanel_playback.C *" <<endl;
56  cout << "**********************************************************************" <<endl;
57 
58  if (TMath::Abs(Step1_Ref-Step1_Size) <= Step_Err) {
59  cout << "Step1: ............................................................ OK" <<endl;
60  } else {
61  cout << "Step1: ........................................................ FAILED" <<endl;
62  }
63 
64  if (TMath::Abs(Step2_Ref-Step2_Size) <= Step_Err) {
65  cout << "Step2: ............................................................ OK" <<endl;
66  } else {
67  cout << "Step2: ........................................................ FAILED" <<endl;
68  }
69 
70  if (TMath::Abs(Step3_Ref-Step3_Size) <= Step_Err) {
71  cout << "Step3: ............................................................ OK" <<endl;
72  } else {
73  cout << "Step3: ........................................................ FAILED" <<endl;
74  }
75 
76  if (TMath::Abs(Step4_Ref-Step4_Size) <= Step_Err) {
77  cout << "Step4: ............................................................ OK" <<endl;
78  } else {
79  cout << "Step4: ........................................................ FAILED" <<endl;
80  }
81 
82  if (TMath::Abs(Step5_Ref-Step5_Size) <= Step_Err) {
83  cout << "Step5: ............................................................ OK" <<endl;
84  } else {
85  cout << "Step5: ........................................................ FAILED" <<endl;
86  }
87  cout << "**********************************************************************" <<endl;
88 
89 }
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition: TSystem.cxx:424
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1374
int Int_t
Definition: RtypesCore.h:41
Long64_t fSize
Definition: TSystem.h:131
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition: TSystem.cxx:445
ROOT::R::TRInterface & r
Definition: Object.C:4
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540