Skip to content

Commit 3878984

Browse files
committed
[test] Use a local TDirectory for the hbars test in stressGraphics.
Previously, gDirectory was used. By creating a local directory, the test has now side effects on gDirectory.
1 parent b1ac300 commit 3878984

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/stressGraphics.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3812,6 +3812,8 @@ void zoomfit()
38123812
void hbars()
38133813
{
38143814
TCanvas *C = StartTest(700,800);
3815+
TDirectory dir("hbars_dir", "Directory for the hbars test");
3816+
TDirectory::TContext dirCtx{&dir};
38153817

38163818
TTree *T = (TTree*)gCernstaff->Get("T");
38173819
T->SetFillColor(45);
@@ -3825,10 +3827,10 @@ void hbars()
38253827
//vertical bar chart
38263828
C->cd(2); gPad->SetGrid(); gPad->SetFrameFillColor(33);
38273829
T->Draw("Division>>hDiv","","goff");
3828-
TH1F *hDiv = (TH1F*)gDirectory->Get("hDiv");
3830+
TH1F *hDiv = (TH1F*)dir.Get("hDiv");
38293831
hDiv->SetStats(0);
38303832
TH1F *hDivFR = (TH1F*)hDiv->Clone("hDivFR");
3831-
hDivFR->SetDirectory(gDirectory);
3833+
hDivFR->SetDirectory(&dir);
38323834
T->Draw("Division>>hDivFR","Nation==\"FR\"","goff");
38333835
hDiv->SetBarWidth(0.45);
38343836
hDiv->SetBarOffset(0.1);

0 commit comments

Comments
 (0)