Skip to content

[gpad] make canvas size consistent in batch vs non-batch#22272

Draft
ferdymercury wants to merge 1 commit into
root-project:masterfrom
ferdymercury:patch-20
Draft

[gpad] make canvas size consistent in batch vs non-batch#22272
ferdymercury wants to merge 1 commit into
root-project:masterfrom
ferdymercury:patch-20

Conversation

@ferdymercury
Copy link
Copy Markdown
Collaborator

@ferdymercury ferdymercury commented May 12, 2026

Fixes #11004

Explores alternative solution to #22226

fyi @rlalik

TODO:

  • Test if this offset is platform-dependent or not. Maybe we need if MACOS -= 4 else -=2
  • Not sure if lines 234 and 880 need to be adapted, too.
  • Maybe create ctest

Reproducer:

// Run either as root -l test_pixels.cpp -b -q
// Or as xvfb-run root -l test_pixels.cpp -q
#include <TCanvas.h>
#include <TROOT.h>
#include <iostream>
void test_pixels() {
    for(Int_t w=500;w<=900;w++) {
        for(Int_t h=500;h<=600;h++) {
            TCanvas *c = new TCanvas("c1","c1",w,h);
            Int_t diffw = w-c->GetWw();
            Int_t diffh = h-c->GetWh();
            if(!gROOT->IsBatch()) {
                if (diffw !=2 || diffh !=24)
                    std::cout << diffw << " " << diffh << " " << w << " " << h << std::endl;
            }
            else {
                if (diffw !=2 || diffh !=24)
                    std::cout << diffw << " " << diffh << " " << w << " " << h << std::endl;
            }
            delete c;
        }
    }
}

@github-actions
Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 11h 5m 31s ⏱️
 3 849 tests  3 844 ✅ 0 💤  5 ❌
76 935 runs  76 852 ✅ 0 💤 83 ❌

For more details on these failures, see this check.

Results for commit b2ec340.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TCanvas size is inconsistent in batch vs non-batch mode

1 participant