Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freeimage: refactor test package #23937

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions recipes/freeimage/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ def build(self):
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
bees = os.path.join(self.source_folder, "test.png")
self.run(f"{bin_path} {bees}", env="conanrun")
self.run(bin_path, env="conanrun")
Binary file removed recipes/freeimage/all/test_package/test.png
Binary file not shown.
29 changes: 2 additions & 27 deletions recipes/freeimage/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,14 @@ void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char* message)
std::cerr << "FreeImage error: " << message << std::endl;
}

int main(int argc, char** argv )
{
if (argc < 2) {
std::cerr << "Need at least one argument" << std::endl;
return 1;
}
int main(int argc, char** argv ) {

#if NEED_INIT
FreeImage_Initialise();
#endif

FreeImage_SetOutputMessage(FreeImageErrorHandler);

std::cout << "FreeImage " << FreeImage_GetVersion() << ", with:" << std::endl;

for (int i = 0; i < FreeImage_GetFIFCount(); ++i)
{
std::cout << "\t- " << FreeImage_GetFIFExtensionList((FREE_IMAGE_FORMAT)i) << std::endl;
}

const char * image_file = argv[1];
FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
fif = FreeImage_GetFileType(image_file, 0);
if (fif == FIF_UNKNOWN) {
fif = FreeImage_GetFIFFromFilename(image_file);
}
if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
FIBITMAP* dib = FreeImage_Load(fif, image_file, 0);
if (dib)
{
FreeImage_Unload(dib);
}
}
std::cout << "FreeImage " << FreeImage_GetVersion() << std::endl;

#if NEED_INIT
FreeImage_DeInitialise();
Expand Down
3 changes: 1 addition & 2 deletions recipes/freeimage/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ def build(self):
def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
bees = os.path.join(self.source_folder, os.pardir, "test_package", "test.png")
self.run(f"{bin_path} {bees}", run_environment=True)
self.run(bin_path, run_environment=True)
Loading