diff options
Diffstat (limited to 'src/ast_video_puller_test.cpp')
-rw-r--r-- | src/ast_video_puller_test.cpp | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/src/ast_video_puller_test.cpp b/src/ast_video_puller_test.cpp index 58adda9697..4fa3dccc68 100644 --- a/src/ast_video_puller_test.cpp +++ b/src/ast_video_puller_test.cpp @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> + #include <ast_jpeg_decoder.hpp> #include <ast_video_puller.hpp> #include <chrono> @@ -10,38 +11,46 @@ #include <iostream> #include <thread> #include <vector> + #include <gmock/gmock.h> #include <gtest/gtest.h> -TEST(AstvideoPuller, BasicRead) { - ast_video::RawVideoBuffer out; - bool have_hardware = false; - if (access("/dev/video", F_OK) != -1) { - ast_video::SimpleVideoPuller p; - p.initialize(); - out = p.readVideo(); - } else { - FILE *fp = fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb"); - if (fp) { - size_t newLen = fread(out.buffer.data(), sizeof(char), - out.buffer.size() * sizeof(long), fp); - if (ferror(fp) != 0) { - fputs("Error reading file", stderr); - } - fclose(fp); - out.buffer.resize(newLen); - out.mode = ast_video::YuvMode::YUV444; - out.width = 800; - out.height = 600; - out.ySelector = 0; - out.uvSelector = 0; +TEST(AstvideoPuller, BasicRead) +{ + ast_video::RawVideoBuffer out; + bool have_hardware = false; + if (access("/dev/video", F_OK) != -1) + { + ast_video::SimpleVideoPuller p; + p.initialize(); + out = p.readVideo(); + } + else + { + FILE *fp = + fopen("test_resources/ubuntu_444_800x600_0chrom_0lum.bin", "rb"); + if (fp) + { + size_t newLen = fread(out.buffer.data(), sizeof(char), + out.buffer.size() * sizeof(long), fp); + if (ferror(fp) != 0) + { + fputs("Error reading file", stderr); + } + fclose(fp); + out.buffer.resize(newLen); + out.mode = ast_video::YuvMode::YUV444; + out.width = 800; + out.height = 600; + out.ySelector = 0; + out.uvSelector = 0; + } } - } - FILE *fp = fopen("/tmp/screendata.bin", "wb"); - fwrite(out.buffer.data(), sizeof(char), out.buffer.size(), fp); + FILE *fp = fopen("/tmp/screendata.bin", "wb"); + fwrite(out.buffer.data(), sizeof(char), out.buffer.size(), fp); - ast_video::AstJpegDecoder d; - d.decode(out.buffer, out.width, out.height, out.mode, out.ySelector, - out.uvSelector); + ast_video::AstJpegDecoder d; + d.decode(out.buffer, out.width, out.height, out.mode, out.ySelector, + out.uvSelector); } |