Fix warning about local variable shadowing in clipping unit test

Use "col" for the "wxColour" variable to avoid clash with "c" one used
for the corner index.

Also just construct the colour directly from the RGB values instead of
default-initializing it and then using Set(), which also allows to make
it "const".
This commit is contained in:
Vadim Zeitlin 2017-10-22 16:43:17 +02:00
parent 9f4f075034
commit aa4c270d73

View File

@ -646,33 +646,32 @@ void ClippingBoxTestCaseBase::CheckClipRect(int x, int y, int width, int height)
for( int py = ymin; py <= ymax; py++ )
for( int px = xmin; px <= xmax; px++ )
{
wxColour c;
unsigned char r = img.GetRed(px, py);
unsigned char g = img.GetGreen(px, py);
unsigned char b = img.GetBlue(px, py);
c.Set(r, g, b);
const wxColour col(r, g, b);
wxString msgColour;
if ( px >= x && px <= x + (width-1) &&
py >= y && py <= y + (height-1) )
{
// Pixel inside the box.
if ( c != s_fgColour )
if ( col != s_fgColour )
{
msgColour =
wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s Expected: %s"),
px, py, c.GetAsString().mbc_str(), s_fgColour.GetAsString().mbc_str());
px, py, col.GetAsString().mbc_str(), s_fgColour.GetAsString().mbc_str());
}
}
else
{
// Pixel outside the box.
if ( c != s_bgColour )
if ( col != s_bgColour )
{
msgColour =
wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s Expected: %s"),
px, py, c.GetAsString().mbc_str(), s_bgColour.GetAsString().mbc_str());
px, py, col.GetAsString().mbc_str(), s_bgColour.GetAsString().mbc_str());
}
}