Release v0.6.32: make screenshot pan test independent of viewport DPI
This commit is contained in:
@@ -225,6 +225,17 @@ int main(int argc, char **argv)
|
||||
require(c.zoom>zoom && std::abs(before.x-after.x)<=1 && std::abs(before.y-after.y)<=1,
|
||||
"Ctrl+wheel zoom keeps image point under cursor");
|
||||
require(!c.history.canUndo(),"zoom does not add image edits to undo history");
|
||||
// A fixed zoom can still fit inside a high-DPI editor. Size the
|
||||
// fixture from the actual viewport, with room for the tested drag
|
||||
// on both axes, then start from a centered view.
|
||||
const double panZoom=std::max({1.0,
|
||||
double(c.canvas.right-c.canvas.left+128)/(c.view.right-c.view.left),
|
||||
double(c.canvas.bottom-c.canvas.top+128)/(c.view.bottom-c.view.top)});
|
||||
ks::zoomCanvas(window,c,panZoom,center);
|
||||
c.panX=c.panY=0; ks::layout(window,c);
|
||||
require(c.view.left+15<c.canvas.left && c.view.top+10<c.canvas.top &&
|
||||
c.view.right>c.canvas.right && c.view.bottom>c.canvas.bottom,
|
||||
"pan fixture has drag clearance on both axes within the supported zoom range");
|
||||
auto view=c.view;
|
||||
SendMessageW(window,WM_MBUTTONDOWN,MK_MBUTTON,MAKELPARAM(center.x,center.y));
|
||||
SendMessageW(window,WM_MOUSEMOVE,MK_MBUTTON,MAKELPARAM(center.x+15,center.y+10));
|
||||
|
||||
Reference in New Issue
Block a user