"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/image_tests.c" between
vnstat-2.7.tar.gz and vnstat-2.8.tar.gz

About: vnStat is a console-based network traffic monitor (using the /proc filesystem).

image_tests.c  (vnstat-2.7):image_tests.c  (vnstat-2.8)
skipping to change at line 19 skipping to change at line 19
START_TEST(initimagecontent_does_not_crash) START_TEST(initimagecontent_does_not_crash)
{ {
IMAGECONTENT ic; IMAGECONTENT ic;
initimagecontent(&ic); initimagecontent(&ic);
} }
END_TEST END_TEST
START_TEST(imageinit_does_not_crash) START_TEST(imageinit_does_not_crash)
{ {
IMAGECONTENT ic; IMAGECONTENT ic;
defaultcfg();
imageinit(&ic, 2, 2); imageinit(&ic, 2, 2);
gdImageDestroy(ic.im); gdImageDestroy(ic.im);
} }
END_TEST END_TEST
START_TEST(layoutinit_does_not_crash) START_TEST(layoutinit_does_not_crash)
{ {
IMAGECONTENT ic; IMAGECONTENT ic;
defaultcfg();
initimagecontent(&ic); initimagecontent(&ic);
imageinit(&ic, 640, 480); imageinit(&ic, 640, 480);
ic.interface.updated = time(NULL); ic.interface.updated = time(NULL);
layoutinit(&ic, "testing 123", 640, 480); layoutinit(&ic, "testing 123", 640, 480);
gdImageDestroy(ic.im); gdImageDestroy(ic.im);
} }
END_TEST END_TEST
START_TEST(getimagevalue_zeropadding) START_TEST(getimagevalue_zeropadding)
{ {
skipping to change at line 420 skipping to change at line 418
START_TEST(libgd_output_comparison) START_TEST(libgd_output_comparison)
{ {
int ret, x, y; int ret, x, y;
IMAGECONTENT ic; IMAGECONTENT ic;
FILE *pngout; FILE *pngout;
x = 1060; x = 1060;
y = 420; y = 420;
defaultcfg();
initimagecontent(&ic); initimagecontent(&ic);
imageinit(&ic, x, y); imageinit(&ic, x, y);
ic.interface.updated = (time_t)get_timestamp(2001, 2, 3, 4, 5); ic.interface.updated = (time_t)get_timestamp(2001, 2, 3, 4, 5);
layoutinit(&ic, "vnstati libgd output comparison", x, y); layoutinit(&ic, "vnstati libgd output comparison", x, y);
pngout = fopen("vnstati_libgd_comparison_check.png", "w"); pngout = fopen("vnstati_libgd_comparison_check.png", "w");
ck_assert_ptr_ne(pngout, NULL); ck_assert_ptr_ne(pngout, NULL);
drawlegend(&ic, 40, 30, 0); drawlegend(&ic, 40, 30, 0);
drawlegend(&ic, 240, 30, 1); drawlegend(&ic, 240, 30, 1);
/* line 1 */ /* line 1 */
x = 40; x = 40;
y = 80; y = 80;
gdImageStringUp(ic.im, gdFontGetSmall(), 1, y + 105, (unsigned char *)"li bgd bug workaround", ic.ctext); gdImageStringUp(ic.im, gdFontGetSmall(), 1, y + 105, (unsigned char *)"li bgd bug workaround", ic.ctext);
drawdonut(&ic, x, y, (float)0, (float)0, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)0, (float)0, 49, 15);
drawdonut(&ic, x + 55, y, (float)50, (float)50, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)50, (float)50, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 0/0 - 50/50", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 0/0 - 50/50", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)100, (float)0, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)100, (float)0, 49, 15);
drawdonut(&ic, x + 55, y, (float)0, (float)100, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)0, (float)100, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 100/0 - 0/100", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 100/0 - 0/100", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)60, (float)40, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)60, (float)40, 49, 15);
drawdonut(&ic, x + 55, y, (float)40, (float)60, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)40, (float)60, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 60/40 - 40/60", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 60/40 - 40/60", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)75, (float)25, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)75, (float)25, 49, 15);
drawdonut(&ic, x + 55, y, (float)25, (float)75, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)25, (float)75, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 75/25 - 25/75", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 75/25 - 25/75", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)90, (float)10, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)90, (float)10, 49, 15);
drawdonut(&ic, x + 55, y, (float)10, (float)90, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)10, (float)90, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 90/10 - 10/90", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 90/10 - 10/90", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)95, (float)5, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)95, (float)5, 49, 15);
drawdonut(&ic, x + 55, y, (float)5, (float)95, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)5, (float)95, 49, 1
5);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 95/5 - 5/95", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 95/5 - 5/95", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)99, (float)1, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)99, (float)1, 49, 15);
drawdonut(&ic, x + 55, y, (float)1, (float)99, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)1, (float)99, 49, 1
5);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 99/1 - 1/99", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 99/1 - 1/99", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)99.9, (float)0.1, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)99.9, (float)0.1, 49, 15
drawdonut(&ic, x + 55, y, (float)0.1, (float)99.9, 49, 15); );
drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)0.1, (float)99.9, 4
9, 15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 99.9/0.1 - 0.1/99.9", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 99.9/0.1 - 0.1/99.9", ic.ctext);
/* line 2 */ /* line 2 */
x = 40; x = 40;
y = 160; y = 160;
drawdonut(&ic, x, y, (float)0, (float)0, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)0, (float)0, 49, 15);
drawdonut(&ic, x + 55, y, (float)25, (float)25, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)25, (float)25, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 0/0 - 25/25", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 0/0 - 25/25", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)50, (float)0, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)50, (float)0, 49, 15);
drawdonut(&ic, x + 55, y, (float)0, (float)50, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)0, (float)50, 49, 1
5);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 50/0 - 0/50", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 50/0 - 0/50", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)40, (float)30, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)40, (float)30, 49, 15);
drawdonut(&ic, x + 55, y, (float)30, (float)40, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)30, (float)40, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 40/30 - 30/40", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 40/30 - 30/40", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)30, (float)20, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)30, (float)20, 49, 15);
drawdonut(&ic, x + 55, y, (float)20, (float)30, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)20, (float)30, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 30/20 - 20/30", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 30/20 - 20/30", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)20, (float)10, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)20, (float)10, 49, 15);
drawdonut(&ic, x + 55, y, (float)10, (float)20, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)10, (float)20, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 20/10 - 10/20", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 20/10 - 10/20", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)15, (float)5, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)15, (float)5, 49, 15);
drawdonut(&ic, x + 55, y, (float)5, (float)15, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)5, (float)15, 49, 1
5);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 15/5 - 5/15", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 15/5 - 5/15", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)10, (float)1, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)10, (float)1, 49, 15);
drawdonut(&ic, x + 55, y, (float)1, (float)10, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)1, (float)10, 49, 1
5);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 10/1 - 1/10", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 10/1 - 1/10", ic.ctext);
x += 130; x += 130;
drawdonut(&ic, x, y, (float)1, (float)0.1, 49, 15); drawdonut_libgd_bug_workaround(&ic, x, y, (float)1, (float)0.1, 49, 15);
drawdonut(&ic, x + 55, y, (float)0.1, (float)1, 49, 15); drawdonut_libgd_bug_workaround(&ic, x + 55, y, (float)0.1, (float)1, 49,
15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 1.0/0.1 - 0.1/1.0", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 1.0/0.1 - 0.1/1.0", ic.ctext);
/* line 3 */ /* line 3 */
x = 40; x = 40;
y = 270; y = 270;
gdImageStringUp(ic.im, gdFontGetSmall(), 1, y + 105, (unsigned char *)"li bgd native", ic.ctext); gdImageStringUp(ic.im, gdFontGetSmall(), 1, y + 105, (unsigned char *)"li bgd native", ic.ctext);
drawdonut_libgd_native(&ic, x, y, (float)0, (float)0, 49, 15); drawdonut_libgd_native(&ic, x, y, (float)0, (float)0, 49, 15);
drawdonut_libgd_native(&ic, x + 55, y, (float)50, (float)50, 49, 15); drawdonut_libgd_native(&ic, x + 55, y, (float)50, (float)50, 49, 15);
gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 0/0 - 50/50", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), x - 20, y + 30, (unsigned char *)" 0/0 - 50/50", ic.ctext);
skipping to change at line 620 skipping to change at line 617
{ {
int ret, x, y, i; int ret, x, y, i;
float f; float f;
char buffer[6]; char buffer[6];
IMAGECONTENT ic; IMAGECONTENT ic;
FILE *pngout; FILE *pngout;
x = 1500; x = 1500;
y = 900; y = 900;
defaultcfg();
initimagecontent(&ic); initimagecontent(&ic);
imageinit(&ic, x, y); imageinit(&ic, x, y);
ic.interface.updated = (time_t)get_timestamp(2012, 3, 4, 5, 6); ic.interface.updated = (time_t)get_timestamp(2012, 3, 4, 5, 6);
layoutinit(&ic, "donut with 0.2% input steps and other elements", x, y); layoutinit(&ic, "donut with 0.2% input steps and other elements", x, y);
pngout = fopen("vnstati_element_check.png", "w"); pngout = fopen("vnstati_element_check.png", "w");
ck_assert_ptr_ne(pngout, NULL); ck_assert_ptr_ne(pngout, NULL);
x = 40; x = 40;
y = 70; y = 70;
skipping to change at line 657 skipping to change at line 653
gdImageString(ic.im, gdFontGetGiant(), 1020, 40, (unsigned char *)"Giant - The quick brown fox jumps over the lazy dog", ic.ctext); gdImageString(ic.im, gdFontGetGiant(), 1020, 40, (unsigned char *)"Giant - The quick brown fox jumps over the lazy dog", ic.ctext);
gdImageString(ic.im, gdFontGetLarge(), 1020, 60, (unsigned char *)"Large - The quick brown fox jumps over the lazy dog", ic.ctext); gdImageString(ic.im, gdFontGetLarge(), 1020, 60, (unsigned char *)"Large - The quick brown fox jumps over the lazy dog", ic.ctext);
gdImageString(ic.im, gdFontGetMediumBold(), 1020, 80, (unsigned char *)"M ediumBold - The quick brown fox jumps over the lazy dog", ic.ctext); gdImageString(ic.im, gdFontGetMediumBold(), 1020, 80, (unsigned char *)"M ediumBold - The quick brown fox jumps over the lazy dog", ic.ctext);
gdImageString(ic.im, gdFontGetSmall(), 1020, 100, (unsigned char *)"Small - The quick brown fox jumps over the lazy dog", ic.ctext); gdImageString(ic.im, gdFontGetSmall(), 1020, 100, (unsigned char *)"Small - The quick brown fox jumps over the lazy dog", ic.ctext);
gdImageString(ic.im, gdFontGetTiny(), 1020, 120, (unsigned char *)"Tiny - The quick brown fox jumps over the lazy dog", ic.ctext); gdImageString(ic.im, gdFontGetTiny(), 1020, 120, (unsigned char *)"Tiny - The quick brown fox jumps over the lazy dog", ic.ctext);
drawlegend(&ic, 1130, 140, 0); drawlegend(&ic, 1130, 140, 0);
drawlegend(&ic, 1330, 140, 1); drawlegend(&ic, 1330, 140, 1);
drawbar(&ic, 1050, 160, 400, 50, 50, 100, 0); drawbar(&ic, 1050, 160, 100, 50, 50, 100, 0);
drawbar(&ic, 1050, 180, 400, 25, 75, 100, 0); drawbar(&ic, 1050, 180, 100, 25, 75, 100, 0);
drawbar(&ic, 1050, 200, 400, 75, 25, 100, 0); drawbar(&ic, 1050, 200, 100, 75, 25, 100, 0);
drawbar(&ic, 1050, 220, 400, 0, 100, 100, 0); drawbar(&ic, 1050, 220, 100, 0, 100, 100, 0);
drawbar(&ic, 1050, 240, 400, 100, 0, 100, 0); drawbar(&ic, 1050, 240, 100, 100, 0, 100, 0);
drawbar(&ic, 1050, 260, 400, 50, 50, 130, 0); drawbar(&ic, 1050, 260, 100, 1, 99, 100, 0);
drawbar(&ic, 1050, 280, 400, 25, 75, 130, 0); drawbar(&ic, 1050, 280, 100, 2, 98, 100, 0);
drawbar(&ic, 1050, 300, 400, 75, 25, 130, 0);
drawbar(&ic, 1050, 320, 400, 0, 100, 130, 0); drawbar(&ic, 1050, 300, 100, 99, 1, 100, 0);
drawbar(&ic, 1050, 340, 400, 100, 0, 130, 0); drawbar(&ic, 1050, 320, 100, 98, 2, 100, 0);
drawbar(&ic, 1200, 160, 100, 1, 0, 100, 0);
drawbar(&ic, 1200, 180, 100, 2, 0, 100, 0);
drawbar(&ic, 1200, 200, 100, 3, 0, 100, 0);
drawbar(&ic, 1200, 220, 100, 0, 1, 100, 0);
drawbar(&ic, 1200, 240, 100, 0, 2, 100, 0);
drawbar(&ic, 1200, 260, 100, 0, 3, 100, 0);
drawbar(&ic, 1200, 280, 100, 25, 25, 100, 0);
drawbar(&ic, 1200, 300, 100, 10, 30, 100, 0);
drawbar(&ic, 1200, 320, 100, 30, 10, 100, 0);
gdImageLine(ic.im, 1040, 360, 1260, 360, ic.ctext); gdImageLine(ic.im, 1040, 360, 1260, 360, ic.ctext);
gdImageLine(ic.im, 1040, 760, 1260, 760, ic.ctext); gdImageLine(ic.im, 1040, 760, 1260, 760, ic.ctext);
gdImageLine(ic.im, 1250, 350, 1250, 770, ic.ctext); gdImageLine(ic.im, 1250, 350, 1250, 770, ic.ctext);
drawarrowup(&ic, 1250, 350); drawarrowup(&ic, 1250, 350);
drawarrowright(&ic, 1260, 360); drawarrowright(&ic, 1260, 360);
drawpoles(&ic, 1050, 360, 400, 50, 50, 100); drawpoles(&ic, 1050, 360, 400, 50, 50, 100);
 End of changes. 21 change blocks. 
47 lines changed or deleted 72 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)