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