graphics/bitmap: Fix tests

This commit is contained in:
Yuri Victorovich 2019-05-27 23:02:19 +00:00
parent 4bc54a25db
commit 7c782be036
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=502838
2 changed files with 26 additions and 2 deletions

View File

@ -22,9 +22,12 @@ PLIST_FILES= include/bitmap_image.hpp
do-install:
${INSTALL_DATA} ${WRKSRC}/bitmap_image.hpp ${STAGEDIR}${PREFIX}/include
do-test: # tests failure reported to the author: Error - Failed to open 'image.bmp'
do-test:
@cd ${WRKSRC} && \
${SETENV} ${MAKE_ENV} ${MAKE_CMD} bitmap_test && \
./bitmap_test
${CXX} ${CXXFLAGS} -o mk-image ${FILESDIR}/mk-image.cpp -I. && \
./mk-image && \
./bitmap_test && \
${ECHO} "Tests succeeded"
.include <bsd.port.mk>

View File

@ -0,0 +1,21 @@
#include "bitmap_image.hpp"
// creates the BMP image image.bmp that tests expect
int main()
{
bitmap_image base(1024, 800);
base.clear();
const double c1 = 0.8;
const double c2 = 0.4;
const double c3 = 0.2;
const double c4 = 0.6;
::srand(0xA5AA57A0);
plasma(base, 0, 0, base.width(), base.height(), c1, c2, c3, c4, 3.0, jet_colormap);
base.save_image("image.bmp");
return 0;
}