00001 #include <Riostream.h>
00002 #include <TSystem.h>
00003 #include <TApplication.h>
00004
00005 #include "TThread.h"
00006 #include "TFndMonitorGUI.h"
00007
00008
00009 TFndMonitorGUI *mon_gui = 0;
00010
00011 void basetest(){
00012
00013
00014 Bool_t test_buttons = 1;
00015 Bool_t test_sub_transient_frames = 1;
00016 Bool_t test_fast_sub_transient_frames = 1;
00017 Bool_t test_reallyfast_sub_transient_frames = 1;
00018 Bool_t test_several_close = 1;
00019
00020 Printf("Building the main GUI");
00021 mon_gui->BuildMainGUI();
00022
00023 if(test_buttons){
00024 Printf("=============> Starting Test 1: Several fast create-close...");
00025 mon_gui->TestDetSelButtons(70,2);
00026 }
00027
00028 if(test_sub_transient_frames){
00029 Printf("=============> Starting Test 2: One-shot create-all / close all...");
00030 mon_gui->BuildProdGUI(0);
00031 gSystem ->Sleep(500);
00032 mon_gui->BuildConsGUI(0,0);
00033 gSystem ->Sleep(500);
00034 mon_gui->BuildEvdGUI(0);
00035 gSystem ->Sleep(1000);
00036 mon_gui->CloseProdGUI();
00037 gSystem ->Sleep(200);
00038 mon_gui->CloseConsGUI();
00039 gSystem ->Sleep(200);
00040 mon_gui->CloseEvdGUI();
00041 }
00042
00043 if(test_fast_sub_transient_frames){
00044 Printf("=============> Starting Test 3: Several fast create-close...");
00045
00046 Printf("Building Producer GUI (10 times)");
00047 for(Int_t i=0;i<10;i++) { mon_gui->BuildProdGUI(0); gSystem->Sleep(10); }
00048
00049
00050 gSystem->Sleep(1000);
00051 Printf("Building Consumer GUI (10 times)");
00052 for(Int_t i=0;i<10;i++) { mon_gui->BuildConsGUI(0,0); gSystem->Sleep(10); }
00053
00054 gSystem->Sleep(1000);
00055 Printf("Building Event display GUI (10 times)");
00056 for(Int_t i=0;i<10;i++) { mon_gui->BuildEvdGUI(0); gSystem->Sleep(10); }
00057 }
00058 mon_gui->CloseProdGUI();
00059 gSystem ->Sleep(200);
00060 mon_gui->CloseConsGUI();
00061 gSystem ->Sleep(200);
00062 mon_gui->CloseEvdGUI();
00063
00064 if(test_reallyfast_sub_transient_frames){
00065 Printf("=============> Starting Test 4: Several (really) fast create-close...");
00066
00067 Printf("Building Producer GUI (50 times)");
00068 for(Int_t i=0;i<50;i++) mon_gui->BuildProdGUI(0);
00069
00070 gSystem->Sleep(1000);
00071 Printf("Building Consumer GUI (50 times)");
00072 for(Int_t i=0;i<50;i++) mon_gui->BuildConsGUI(0,0);
00073
00074 gSystem->Sleep(1000);
00075 Printf("Building Event display GUI (50 times)");
00076 for(Int_t i=0;i<50;i++) mon_gui->BuildEvdGUI(0);
00077 }
00078 mon_gui->CloseProdGUI();
00079 gSystem ->Sleep(200);
00080 mon_gui->CloseConsGUI();
00081 gSystem ->Sleep(200);
00082 mon_gui->CloseEvdGUI();
00083
00084
00085
00086 if(test_several_close){
00087 Printf("=============> Starting Test 4: Several close operation are performed");
00088 gSystem->Sleep(1000);
00089 for(Int_t i=0;i<3;i++){
00090 Printf("Closing Producer GUI (%d)",i);
00091 mon_gui->CloseProdGUI();
00092 gSystem->Sleep(100);
00093 }
00094
00095 gSystem->Sleep(1000);
00096 for(Int_t i=0;i<3;i++){
00097 Printf("Closing Consumer GUI (%d)",i);
00098 mon_gui->CloseConsGUI();
00099 gSystem->Sleep(100);
00100 }
00101
00102
00103 gSystem->Sleep(1000);
00104 for(Int_t i=0;i<3;i++){
00105 Printf("Closing Event-display GUI (%d)",i);
00106 mon_gui->CloseEvdGUI();
00107 gSystem->Sleep(100);
00108 }
00109 }
00110 Printf("=============> Now deleting the main GUI");
00111 delete mon_gui;
00112 Printf("=============> Test completed succesfully!");
00113 return;
00114 }
00115
00116
00117 void *HandleMainGUI_1(void *ptr){
00118
00119 ptr=0;
00120 mon_gui->BuildMainGUI();
00121
00122 return 0;
00123 }
00124
00125
00126 void FinalTest(Bool_t use_thread){
00127
00128 if(use_thread){
00129 TThread *MainGUIThread = new TThread("main_gui_thread_1",HandleMainGUI_1,(void *)1);
00130 MainGUIThread->Run();
00131 }
00132 else mon_gui->BuildMainGUI();
00133
00134 }
00135
00136
00137
00138 void TestMonitorGUI(){
00139
00140
00141 mon_gui = new TFndMonitorGUI();
00142
00143 FinalTest(kFALSE);
00144
00145 }
00146
00147
00148
00149 #ifdef STANDALONE
00150 int main(int argc, char **argv)
00151 {
00152 TApplication theApp("Monitor GUI test", &argc, argv);
00153 TestMonitorGUI();
00154 theApp.Run();
00155 return 0;
00156 }
00157 #endif
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168