#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "gtest-utils.h"
#include <gtest/gtest.h>
#include <string>
extern "C" int cjpeg(int argc, char *argv[]);
TEST(CJPEGTest, RGBISlow) { … }
TEST(CJPEGTest, IFastOpt422) { … }
TEST(CJPEGTest, IFastProg420Q100) { … }
TEST(CJPEGTest, GrayISlow) { … }
TEST(CJPEGTest, IFastOpt420S) { … }
TEST(CJPEGTest, FloatProg3x2) { … }
TEST(CJPEGTest, IFastProg3x2) { … }
#ifdef C_ARITH_CODING_SUPPORTED
TEST(CJPEGTest, ISlowAri420) {
base::FilePath input_image_path;
GetTestFilePath(&input_image_path, "testorig.ppm");
base::FilePath output_path(GetTargetDirectory());
output_path = output_path.AppendASCII("testout_420_islow_ari.jpg");
std::string prog_name = "cjpeg";
std::string arg1 = "-dct";
std::string arg2 = "int";
std::string arg3 = "-arithmetic";
std::string arg4 = "-outfile";
std::string arg5 = output_path.MaybeAsASCII();
std::string arg6 = input_image_path.MaybeAsASCII();
char *command_line[] = { &prog_name[0],
&arg1[0], &arg2[0], &arg3[0], &arg4[0], &arg5[0],
&arg6[0]
};
EXPECT_EQ(cjpeg(7, command_line), 0);
const std::string EXPECTED_MD5 = "e986fb0a637a8d833d96e8a6d6d84ea1";
EXPECT_TRUE(CompareFileAndMD5(output_path, EXPECTED_MD5));
}
TEST(CJPEGTest, ISlowProgAri444) {
base::FilePath input_image_path;
GetTestFilePath(&input_image_path, "testorig.ppm");
base::FilePath output_path(GetTargetDirectory());
output_path = output_path.AppendASCII("testout_444_islow_progari.jpg");
std::string prog_name = "cjpeg";
std::string arg1 = "-sample";
std::string arg2 = "1x1";
std::string arg3 = "-dct";
std::string arg4 = "int";
std::string arg5 = "-prog";
std::string arg6 = "-arithmetic";
std::string arg7 = "-outfile";
std::string arg8 = output_path.MaybeAsASCII();
std::string arg9 = input_image_path.MaybeAsASCII();
char *command_line[] = { &prog_name[0],
&arg1[0], &arg2[0], &arg3[0], &arg4[0], &arg5[0],
&arg6[0], &arg7[0], &arg8[0], &arg9[0]
};
EXPECT_EQ(cjpeg(10, command_line), 0);
const std::string EXPECTED_MD5 = "0a8f1c8f66e113c3cf635df0a475a617";
EXPECT_TRUE(CompareFileAndMD5(output_path, EXPECTED_MD5));
}
TEST(CJPEGTest, ISlowAri444) {
base::FilePath input_image_path;
GetTestFilePath(&input_image_path, "testorig.ppm");
base::FilePath output_path(GetTargetDirectory());
output_path = output_path.AppendASCII("testout_444_islow_ari.jpg");
std::string prog_name = "cjpeg";
std::string arg1 = "-dct";
std::string arg2 = "int";
std::string arg3 = "-arithmetic";
std::string arg4 = "-sample";
std::string arg5 = "1x1";
std::string arg6 = "-outfile";
std::string arg7 = output_path.MaybeAsASCII();
std::string arg8 = input_image_path.MaybeAsASCII();
char *command_line[] = { &prog_name[0],
&arg1[0], &arg2[0], &arg3[0], &arg4[0], &arg5[0],
&arg6[0], &arg7[0], &arg8[0]
};
EXPECT_EQ(cjpeg(9, command_line), 0);
const std::string EXPECTED_MD5 = "dd1b827fc504feb0259894e7132585b4";
EXPECT_TRUE(CompareFileAndMD5(output_path, EXPECTED_MD5));
}
#endif
TEST(CJPEGTest, ISlowProg420) { … }
TEST(CJPEGTest, ISlow444) { … }
TEST(CJPEGTest, ISlowProg444) { … }