I have exposed OutputDevice’s SetOutOffXPixel() and SetOutOffYPixel() so I can 
run some unit tests, and I’m surprised that LogicToPixel(Point) doesn’t take 
into account the offset…

void OutputDeviceMapTest::testOffsetPropagation() 
{
    ScopedVclPtr<TestVirtualDevice> pDev(VclPtr<TestVirtualDevice>::Create()); 
       
    nOffsetX = 50; 
    long nOffsetY = 20; 

    pDev->SetOutOffXPixel(nOffsetX); 
    pDev->SetOutOffYPixel(nOffsetY); 

    CPPUNIT_ASSERT_EQUAL(nOffsetX, pDev->GetOutOffXPixel()); // Verify 
Calculation (LogicToPixel adds the offset) 
    Point aZero(0, 0); 
    Point aResult = pDev->LogicToPixel(aZero); 

    CPPUNIT_ASSERT_EQUAL_MESSAGE("LogicToPixel should include Output Offset", 
Point(nOffsetX, nOffsetY), aResult); 
}

This fails with a Point(0, 0), instead of Point(50, 20) as I would have 
expected. 

My question is: have I found a bug, or is this expected behaviour?

Chris

Reply via email to