Instead of: testCanvas->cd(...); try: gROOT->SetSelectedPad(testCanvas->cd(...));
testCanvas->cd(...);
gROOT->SetSelectedPad(testCanvas->cd(...));