Skip to content

Commit 41e95c0

Browse files
committed
Provide special virtualx for fitpanel UnitTesting
To correctly run gui classes, gVirtualX->CreateGC should return every time unique value. Otherwise cleanup of many classes does not work correctly.
1 parent 6ccd05a commit 41e95c0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

gui/fitpanel/test/UnitTesting.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "TError.h"
1111

1212
#include "TGComboBox.h"
13+
#include "TVirtualX.h"
1314

1415
#include "TF2.h"
1516
#include "TMath.h"
@@ -26,6 +27,17 @@
2627

2728
#include "../src/CommonDefs.h"
2829

30+
class TTestVirtualX : public TVirtualX {
31+
Long_t fCounter = 1;
32+
public:
33+
34+
TTestVirtualX(const char *name, const char *title) : TVirtualX(name, title) {}
35+
36+
GContext_t CreateGC(Drawable_t, GCValues_t *) override
37+
{
38+
return (GContext_t) fCounter++;
39+
}
40+
};
2941

3042
TString gTmpfilename;
3143

@@ -482,6 +494,9 @@ class FitEditorUnitTesting
482494
// tests
483495
int UnitTesting()
484496
{
497+
if (gROOT->IsBatch())
498+
gVirtualX = new TTestVirtualX("BatchTest", "ROOT Interface to batch graphics");
499+
485500
gROOT->SetWebDisplay("off");
486501

487502
gTmpfilename = "UnitTesting.log";

0 commit comments

Comments
 (0)