Larger maximal canvas portion size

This commit is contained in:
Michaël Lemaire 2014-08-21 10:11:44 +02:00
parent 0bb1cf5bed
commit 6c4a16966c
2 changed files with 11 additions and 11 deletions

View file

@ -27,8 +27,8 @@ Canvas::~Canvas()
void Canvas::setSize(int width, int height)
{
horizontal_portion_count = 1 + (width - 1) / 400;
vertical_portion_count = 1 + (height - 1) / 400;
horizontal_portion_count = 1 + (width - 1) / 800;
vertical_portion_count = 1 + (height - 1) / 800;
int portion_width = width / horizontal_portion_count;
int portion_height = height / vertical_portion_count;

View file

@ -28,15 +28,15 @@ TEST(Canvas, SizingAndCutting)
ASSERT_EQ(1, canvas.getVerticalPortionCount());
checkPortion(canvas, 0, 0, 200, 100);
canvas.setSize(600, 501);
EXPECT_EQ(600, canvas.getWidth());
EXPECT_EQ(501, canvas.getHeight());
EXPECT_EQ(600, canvas.getPreview()->getWidth());
EXPECT_EQ(501, canvas.getPreview()->getHeight());
canvas.setSize(1100, 901);
EXPECT_EQ(1100, canvas.getWidth());
EXPECT_EQ(901, canvas.getHeight());
EXPECT_EQ(550, canvas.getPreview()->getWidth());
EXPECT_EQ(450, canvas.getPreview()->getHeight());
ASSERT_EQ(2, canvas.getHorizontalPortionCount());
ASSERT_EQ(2, canvas.getVerticalPortionCount());
checkPortion(canvas, 0, 0, 300, 250);
checkPortion(canvas, 0, 1, 300, 251);
checkPortion(canvas, 1, 0, 300, 250);
checkPortion(canvas, 1, 1, 300, 251);
checkPortion(canvas, 0, 0, 550, 450);
checkPortion(canvas, 0, 1, 550, 451);
checkPortion(canvas, 1, 0, 550, 450);
checkPortion(canvas, 1, 1, 550, 451);
}