Added tests for new zero_border_pixels() overload.

This commit is contained in:
Davis King 2013-11-05 17:37:23 -05:00
parent 4329935f71
commit 9ab1f7cc70

View File

@ -1036,6 +1036,65 @@ namespace
DLIB_TEST(img[1][2] == 1); DLIB_TEST(img[1][2] == 1);
DLIB_TEST(img[2][2] == 1); DLIB_TEST(img[2][2] == 1);
rectangle rect = get_rect(img);
rect.left()+=2;
rect.top()+=1;
rect.right()-=2;
rect.bottom()-=1;
assign_all_pixels(img, 1);
zero_border_pixels(img, rect);
DLIB_TEST(img[0][0] == 0);
DLIB_TEST(img[1][0] == 0);
DLIB_TEST(img[2][0] == 0);
DLIB_TEST(img[3][0] == 0);
DLIB_TEST(img[0][1] == 0);
DLIB_TEST(img[1][1] == 0);
DLIB_TEST(img[2][1] == 0);
DLIB_TEST(img[3][1] == 0);
DLIB_TEST(img[0][3] == 0);
DLIB_TEST(img[1][3] == 0);
DLIB_TEST(img[2][3] == 0);
DLIB_TEST(img[3][3] == 0);
DLIB_TEST(img[0][4] == 0);
DLIB_TEST(img[1][4] == 0);
DLIB_TEST(img[2][4] == 0);
DLIB_TEST(img[3][4] == 0);
DLIB_TEST(img[0][2] == 0);
DLIB_TEST(img[3][2] == 0);
DLIB_TEST(img[1][2] == 1);
DLIB_TEST(img[2][2] == 1);
rect.right()+=1;
assign_all_pixels(img, 1);
zero_border_pixels(img, rect);
DLIB_TEST(img[0][0] == 0);
DLIB_TEST(img[1][0] == 0);
DLIB_TEST(img[2][0] == 0);
DLIB_TEST(img[3][0] == 0);
DLIB_TEST(img[0][1] == 0);
DLIB_TEST(img[1][1] == 0);
DLIB_TEST(img[2][1] == 0);
DLIB_TEST(img[3][1] == 0);
DLIB_TEST(img[0][3] == 0);
DLIB_TEST(img[1][3] == 1);
DLIB_TEST(img[2][3] == 1);
DLIB_TEST(img[3][3] == 0);
DLIB_TEST(img[0][4] == 0);
DLIB_TEST(img[1][4] == 0);
DLIB_TEST(img[2][4] == 0);
DLIB_TEST(img[3][4] == 0);
DLIB_TEST(img[0][2] == 0);
DLIB_TEST(img[3][2] == 0);
DLIB_TEST(img[1][2] == 1);
DLIB_TEST(img[2][2] == 1);
} }