Fix a QA test for bitmaps, to work with latest changes in bitmap code.

cherry pick from 05b68413f7
This commit is contained in:
jean-pierre charras 2023-02-15 14:37:01 +01:00
parent 49f6a63a06
commit f13fda9be5
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 KiCad Developers, see AUTHORS.TXT for contributors. * Copyright (C) 2023 KiCad Developers, see AUTHORS.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -105,11 +105,12 @@ BOOST_AUTO_TEST_CASE( Empty )
BITMAP_BASE empty; BITMAP_BASE empty;
// Const to test we can get this data from a const object // Const to test we can get this data from a const object
const BITMAP_BASE& cempty = empty; const BITMAP_BASE& cempty = empty;
const int expected_ppi = 300;
BOOST_CHECK_EQUAL( cempty.GetImageData(), nullptr ); BOOST_CHECK_EQUAL( cempty.GetImageData(), nullptr );
BOOST_CHECK_EQUAL( cempty.GetPPI(), 300 ); BOOST_CHECK_EQUAL( cempty.GetPPI(), expected_ppi );
BOOST_CHECK_EQUAL( cempty.GetScale(), 1.0 ); BOOST_CHECK_EQUAL( cempty.GetScale(), 1.0 );
BOOST_CHECK_EQUAL( cempty.GetPixelSizeIu(), 254000.0 / 300.0 ); BOOST_CHECK_EQUAL( cempty.GetPixelSizeIu(), 254000.0 / expected_ppi );
// can do this on an empty image // can do this on an empty image
empty.Rotate( true ); empty.Rotate( true );
@ -150,7 +151,8 @@ BOOST_AUTO_TEST_CASE( BasicProps )
BOOST_REQUIRE_NE( img.GetImageData(), nullptr ); BOOST_REQUIRE_NE( img.GetImageData(), nullptr );
// still default props here // still default props here
BOOST_CHECK_EQUAL( img.GetPPI(), 300 ); const int expected_ppi = 94;
BOOST_CHECK_EQUAL( img.GetPPI(), expected_ppi );
BOOST_CHECK_EQUAL( img.GetScale(), 5.0 ); BOOST_CHECK_EQUAL( img.GetScale(), 5.0 );
// we changed this, make sure it's right // we changed this, make sure it's right