Skip to content

Commit 7282024

Browse files
authored
Fix stressGUI (#22193)
* Fix stressGUI * Fix the Tetris test and the games.C tutorial (used in stressGUI) * Ony build Tetris if the GUI option is enabled * Remove guihtml related code
1 parent dab4218 commit 7282024

4 files changed

Lines changed: 57 additions & 79 deletions

File tree

test/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,22 @@ ROOT_ADD_TEST(test-vlazy COMMAND vlazy)
9292
#--helloso------------------------------------------------------------------------------------
9393
ROOT_GENERATE_DICTIONARY(G__Hello ${CMAKE_CURRENT_SOURCE_DIR}/Hello.h MODULE Hello DEPENDENCIES Gpad Graf Hist MathCore Matrix)
9494
ROOT_LINKER_LIBRARY(Hello Hello.cxx G__Hello.cxx LIBRARIES Graf Gpad)
95+
ROOT_SET_OUTPUT_DIRECTORIES(Hello)
96+
set_target_properties(Hello PROPERTIES PREFIX "")
9597

9698
#--Aclockso------------------------------------------------------------------------------------
9799
ROOT_GENERATE_DICTIONARY(G__Aclock ${CMAKE_CURRENT_SOURCE_DIR}/Aclock.h MODULE Aclock DEPENDENCIES Graf Gpad MathCore)
98100
ROOT_LINKER_LIBRARY(Aclock Aclock.cxx G__Aclock.cxx LIBRARIES Graf Gpad)
101+
ROOT_SET_OUTPUT_DIRECTORIES(Aclock)
102+
set_target_properties(Aclock PROPERTIES PREFIX "")
103+
104+
#--tetris------------------------------------------------------------------------------------
105+
if(TARGET Gui)
106+
ROOT_GENERATE_DICTIONARY(G__Tetris ${CMAKE_CURRENT_SOURCE_DIR}/Tetris.h MODULE Tetris DEPENDENCIES Graf Gpad Gui MathCore)
107+
ROOT_LINKER_LIBRARY(Tetris Tetris.cxx G__Tetris.cxx LIBRARIES Core Graf Gui MathCore)
108+
ROOT_SET_OUTPUT_DIRECTORIES(Tetris)
109+
set_target_properties(Tetris PROPERTIES PREFIX "")
110+
endif()
99111

100112
#--bench------------------------------------------------------------------------------------
101113
ROOT_GENERATE_DICTIONARY(G__TBench ${CMAKE_CURRENT_SOURCE_DIR}/TBench.h MODULE TBench LINKDEF benchLinkDef.h DEPENDENCIES MathCore Tree)

test/Tetris.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616
#ifndef TETRIS_H
1717
#define TETRIS_H
1818

19+
#ifdef __ROOTCLING__
20+
#pragma link C++ class Tetris+;
21+
#pragma link C++ class TetrisBox+;
22+
#pragma link C++ class TetrisPiece+;
23+
#pragma link C++ class CurrentPiece+;
24+
#pragma link C++ class TetrisBoard+;
25+
#pragma link C++ class NextPiecePad+;
26+
#pragma link C++ class InfoPad+;
27+
#pragma link C++ class NewGameButton+;
28+
#pragma link C++ class QuitButton+;
29+
#pragma link C++ class PauseButton+;
30+
#pragma link C++ class KeyHandler+;
31+
#pragma link C++ class UpdateLevelTimer+;
32+
#endif
33+
1934
#include <TTimer.h>
2035
#include <TCanvas.h>
2136
#include <TGFrame.h>

test/stressGUI.cxx

Lines changed: 24 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#include <TGSplitFrame.h>
7676
#include <TGTextEditor.h>
7777
#include <TRootHelpDialog.h>
78-
#include <TGHtmlBrowser.h>
7978
#include <HelpText.h>
8079
#include <TSystemDirectory.h>
8180
#include <TInterpreter.h>
@@ -90,6 +89,7 @@ Int_t gTestNum = 0;
9089
Bool_t gOptionRef = kFALSE;
9190
Bool_t gOptionKeep = kFALSE;
9291
Bool_t gOptionFull = kFALSE;
92+
Bool_t gOptionDebug = kFALSE;
9393
char gLine[80];
9494
Int_t sizes[100];
9595
TString gTmpfilename;
@@ -177,7 +177,7 @@ void ProcessFrame(TGFrame *f, const char *title)
177177
img->WriteImage(outfile);
178178

179179
if (!gOptionRef) {
180-
if (!strstr(title, "Pack Frames") && !strstr(title, "HTML Browser")) {
180+
if (!strstr(title, "Pack Frames")) {
181181
gSystem->RedirectOutput(gTmpfilename.Data(), "w", &gRH);
182182
TString macrofile = TString::Format("sgui_%02d.C", gTestNum);
183183
((TGMainFrame *)f)->SaveSource(macrofile);
@@ -1997,45 +1997,6 @@ void testHelpDialog()
19971997
hd->CloseWindow();
19981998
}
19991999

2000-
////////////////////////////////////////////////////////////////////////////////
2001-
2002-
////////////////////////////////////////////////////////////////////////////////
2003-
/// Test the ASImage palette editor.
2004-
2005-
void testPaletteEditor()
2006-
{
2007-
const char *fname = "galaxy.root";
2008-
TFile *gal = 0;
2009-
if (!gSystem->AccessPathName(fname)) {
2010-
gal = TFile::Open(fname);
2011-
} else {
2012-
gal = TFile::Open(Form("http://root.cern/files/%s",fname));
2013-
}
2014-
if (!gal) return;
2015-
TImage *img = (TImage*)gal->Get("n4254");
2016-
//img->Draw();
2017-
2018-
TASPaletteEditor *f = new TASPaletteEditor((TAttImage *)img, 80, 25);
2019-
ProcessFrame((TGMainFrame*)f, "Palette Editor");
2020-
f->CloseWindow();
2021-
2022-
delete img;
2023-
}
2024-
2025-
////////////////////////////////////////////////////////////////////////////////
2026-
2027-
////////////////////////////////////////////////////////////////////////////////
2028-
/// Test the HTML Browser.
2029-
2030-
void testHtmlBrowser()
2031-
{
2032-
TGHtmlBrowser *b = new TGHtmlBrowser("https://bellenot.web.cern.ch/public/html_test/html_test.html");
2033-
ProcessFrame((TGMainFrame*)b, "HTML Browser 1");
2034-
b->Selected("https://bellenot.web.cern.ch/public/html_test/gallery/");
2035-
ProcessFrame((TGMainFrame*)b, "HTML Browser 2");
2036-
b->CloseWindow();
2037-
}
2038-
20392000
////////////////////////////////////////////////////////////////////////////////
20402001
// ROOT GUI tutorials
20412002
////////////////////////////////////////////////////////////////////////////////
@@ -2057,21 +2018,21 @@ const char *excluded[] = {
20572018
Int_t bexec(TString &dir, const char *macro)
20582019
{
20592020
#ifdef WIN32
2060-
return gSystem->Exec(TString::Format("set ROOT_HIST=0 & root.exe -q exec_macro.C(\\\"%s/%s\\\") >nul 2>&1", dir.Data(), macro));
2021+
return gSystem->Exec(TString::Format("set ROOT_HIST=0 & root.exe -l -q exec_macro.C(\\\"%s/%s\\\") >nul 2>&1", dir.Data(), macro));
20612022
#else
2062-
return gSystem->Exec(TString::Format("ROOT_HIST=0 root.exe -q exec_macro.C\\(\\\"%s/%s\\\"\\) >&/dev/null", dir.Data(), macro));
2023+
return gSystem->Exec(TString::Format("ROOT_HIST=0 root.exe -l -q exec_macro.C\\(\\\"%s/%s\\\"\\) >&/dev/null", dir.Data(), macro));
20632024
#endif
20642025
}
20652026

20662027
////////////////////////////////////////////////////////////////////////////////
2067-
/// Run the macros available in $ROOTSYS/tutorials/gui
2028+
/// Run the macros available in $ROOTSYS/tutorials/visualisation/gui
20682029

20692030
void run_tutorials()
20702031
{
20712032
gClient->HandleInput();
20722033
gSystem->Sleep(50);
20732034
gSystem->ProcessEvents();
2074-
TString dir = gRootSys + "/tutorials/gui";
2035+
TString dir = gRootSys + "/tutorials/visualisation/gui";
20752036
TString savdir = gSystem->WorkingDirectory();
20762037
TSystemDirectory sysdir(dir.Data(), dir.Data());
20772038
TList *files = sysdir.GetListOfFiles();
@@ -2083,12 +2044,12 @@ void run_tutorials()
20832044
bexec(dir, "hsimple.C");
20842045
gSystem->Unlink("hsimple_1.png");
20852046
}
2086-
dir += "/tree";
2047+
dir += "io/tree/";
20872048
reqfile = dir + "/cernstaff.root";
20882049
if (gSystem->AccessPathName(reqfile, kFileExists)) {
2089-
bexec(dir, "cernbuild.C");
2050+
bexec(dir, "tree500_cernbuild.C");
20902051
}
2091-
dir = gRootSys + "/tutorials/gui";
2052+
dir = gRootSys + "/tutorials/visualisation/gui";
20922053

20932054
if (files) {
20942055
TIter next(files);
@@ -2113,7 +2074,7 @@ void run_tutorials()
21132074
}
21142075
delete files;
21152076
}
2116-
dir = gRootSys + "/tutorials/image";
2077+
dir = gRootSys + "/tutorials/visualisation/image";
21172078
bexec(dir, "galaxy_image.C");
21182079
ProcessMacro("galaxy_image.C", "galaxy_image.C");
21192080

@@ -2155,7 +2116,7 @@ void guitest_playback()
21552116
printf("Guitest Playback..............................................");
21562117
gSystem->RedirectOutput(gTmpfilename.Data(), "w", &gRH);
21572118
TString savdir = gSystem->WorkingDirectory();
2158-
TString dir = gRootSys + "/tutorials/gui";
2119+
TString dir = gRootSys + "/tutorials/visualisation/gui";
21592120
gSystem->ChangeDirectory(dir.Data());
21602121

21612122
// first delete old files, if any
@@ -2230,7 +2191,7 @@ void dnd_playback()
22302191
#else
22312192
filename += "_x11.root";
22322193
#endif
2233-
TString dir = gRootSys + "/tutorials/gui";
2194+
TString dir = gRootSys + "/tutorials/visualisation/gui";
22342195
gSystem->ChangeDirectory(dir.Data());
22352196

22362197
TStopwatch sw;
@@ -2265,7 +2226,7 @@ void mditest_playback()
22652226
printf("MDI Test Playback.............................................");
22662227
gSystem->RedirectOutput(gTmpfilename.Data(), "w", &gRH);
22672228
TString savdir = gSystem->WorkingDirectory();
2268-
TString dir = gRootSys + "/tutorials/gui";
2229+
TString dir = gRootSys + "/tutorials/visualisation/gui";
22692230
gSystem->ChangeDirectory(dir.Data());
22702231

22712232
TStopwatch sw;
@@ -2300,7 +2261,7 @@ void graph_edit_playback()
23002261
printf("Graphic Editors Playback......................................");
23012262
gSystem->RedirectOutput(gTmpfilename.Data(), "w", &gRH);
23022263
TString savdir = gSystem->WorkingDirectory();
2303-
TString dir = gRootSys + "/tutorials/graphics";
2264+
TString dir = gRootSys + "/tutorials/visualisation/graphics";
23042265
gSystem->ChangeDirectory(dir.Data());
23052266

23062267
TStopwatch sw;
@@ -2335,7 +2296,7 @@ void fitpanel_playback()
23352296
printf("Fit Panel Playback ...........................................");
23362297
gSystem->RedirectOutput(gTmpfilename.Data(), "w", &gRH);
23372298
TString savdir = gSystem->WorkingDirectory();
2338-
TString dir = gRootSys + "/tutorials/fit";
2299+
TString dir = gRootSys + "/tutorials/math/fit";
23392300
gSystem->ChangeDirectory(dir.Data());
23402301

23412302
TStopwatch sw;
@@ -2416,7 +2377,7 @@ void stressGUI()
24162377
gBenchmark->Start("stressGUI");
24172378

24182379
if (!gOptionRef) {
2419-
std::cout << "* Running macros in $ROOTSYS/tutorials/gui - S T R E S S *" <<std::endl;
2380+
std::cout << "* Running macros in tutorials/visualisation/gui - S T R E S S *" <<std::endl;
24202381
std::cout << "**********************************************************************" <<std::endl;
24212382
}
24222383
run_tutorials();
@@ -2452,8 +2413,6 @@ void stressGUI()
24522413
testSplitFrame();
24532414
testControlBars();
24542415
testHelpDialog();
2455-
testPaletteEditor();
2456-
testHtmlBrowser();
24572416

24582417
if (!gOptionRef) {
24592418

@@ -2526,6 +2485,9 @@ void stressGUI()
25262485
fclose(sgref);
25272486
}
25282487
gSystem->Unlink(gTmpfilename.Data());
2488+
if (gOptionDebug) {
2489+
gClient->GetPicturePool()->Print();
2490+
}
25292491
#ifdef WIN32
25302492
gSystem->Exec("erase /q /s TxtEdit* >nul 2>&1");
25312493
gSystem->Exec("erase /q /s TxtView* >nul 2>&1");
@@ -2549,13 +2511,15 @@ int main(int argc, char *argv[])
25492511
gOptionRef = kFALSE;
25502512
gOptionKeep = kFALSE;
25512513
gOptionFull = kFALSE;
2514+
gOptionDebug = kFALSE;
25522515
gTmpfilename = "stress-gui";
25532516
FILE *f = gSystem->TempFileName(gTmpfilename);
25542517
fclose(f);
25552518
for (int i = 0; i < argc; i++) {
25562519
if (!strcmp(argv[i], "-ref")) gOptionRef = kTRUE;
25572520
if (!strcmp(argv[i], "-keep")) gOptionKeep = kTRUE;
25582521
if (!strcmp(argv[i], "-full")) gOptionFull = kTRUE;
2522+
if (!strcmp(argv[i], "-debug")) gOptionDebug = kTRUE;
25592523
if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "-?")) {
25602524
printf("Usage: stressGUI [-ref] [-keep] [-full] [-help] [-?] \n");
25612525
printf("Options:\n");
@@ -2565,6 +2529,9 @@ int main(int argc, char *argv[])
25652529
printf(" -keep: Keep the png files even for passed tests\n");
25662530
printf(" (by default the png files are deleted)\n");
25672531
printf("\n");
2532+
printf(" -debug: print debug information like for example\n");
2533+
printf(" picture refcount\n");
2534+
printf("\n");
25682535
printf(" -full: Full test: replay also recorder sessions\n");
25692536
printf(" (guitest, drag and drop, fitpanel, ...)\n");
25702537
printf("\n");

tutorials/visualisation/gui/games.C

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,24 @@ void games()
1616
Bool_t UNIX = strcmp(gSystem->GetName(), "Unix") == 0;
1717
Int_t st1 = gSystem->Load("$(ROOTSYS)/test/Aclock");
1818
if (st1 == -1) {
19-
printf("===>The macro games will try to build the Aclock library\n");
20-
if (UNIX)
21-
gSystem->Exec("(cd $ROOTSYS/test; make Aclock)");
22-
else
23-
gSystem->Exec("(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Aclock.dll)");
24-
25-
st1 = gSystem->Load("$(ROOTSYS)/test/Aclock");
19+
printf("===>The $(ROOTSYS)/test/Aclock library failed to load\n");
2620
}
2721
Int_t st2 = gSystem->Load("$(ROOTSYS)/test/Hello");
2822
if (st2 == -1) {
29-
printf("===>The macro games will try to build the Hello library\n");
30-
if (UNIX)
31-
gSystem->Exec("(cd $ROOTSYS/test; make Hello)");
32-
else
33-
gSystem->Exec("(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Hello.dll)");
34-
35-
st2 = gSystem->Load("$(ROOTSYS)/test/Hello");
23+
printf("===>The $(ROOTSYS)/test/Hello library failed to load\n");
3624
}
3725
Int_t st3 = gSystem->Load("$(ROOTSYS)/test/Tetris");
3826
if (st3 == -1) {
39-
if (UNIX) {
40-
printf("===>The macro games will try to build the Tetris library\n");
41-
gSystem->Exec("(cd $ROOTSYS/test; make Tetris)");
42-
} else {
43-
gSystem->Exec("(cd %ROOTSYS%\\test && nmake -f Makefile.win32 Tetris.dll)");
44-
}
45-
st3 = gSystem->Load("$(ROOTSYS)/test/Tetris");
27+
printf("===>The $(ROOTSYS)/test/Tetris library failed to load\n");
4628
}
4729
if (st1 || st2 || st3) {
48-
printf("ERROR: one of the shared libs in $ROOTSYS/test didn't load properly\n");
30+
printf("ERROR: at least one of the shared libs in $ROOTSYS/test didn't load properly\n");
4931
return;
5032
}
5133
gROOT->ProcessLine("#define __RUN_GAMES__ 1");
5234

35+
gInterpreter->AddIncludePath("${ROOTSYS}/test");
36+
5337
// Add this for CLING not to complain
5438
gROOT->ProcessLine("#include \"Hello.h\"");
5539
gROOT->ProcessLine("#include \"Aclock.h\"");

0 commit comments

Comments
 (0)