Skip to content

Commit

Permalink
(#24134) msdfgen: refactor test package
Browse files Browse the repository at this point in the history
Co-authored-by: Uilian Ries <[email protected]>
  • Loading branch information
ErniGH and uilianries authored May 28, 2024
1 parent 61f21ae commit d6319bd
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
Binary file removed recipes/msdfgen/all/test_package/OpenSans-Bold.ttf
Binary file not shown.
3 changes: 1 addition & 2 deletions recipes/msdfgen/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")
ttf_path = os.path.join(self.source_folder, "OpenSans-Bold.ttf")
self.run(f"{bin_path} {ttf_path}", env="conanrun")
self.run(bin_path, env="conanrun")
19 changes: 1 addition & 18 deletions recipes/msdfgen/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,9 @@
#include <iostream>

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

msdfgen::FreetypeHandle *ft = msdfgen::initializeFreetype();
if (ft) {
msdfgen::FontHandle *font = msdfgen::loadFont(ft, argv[1]);
if (font) {
msdfgen::Shape shape;
if (msdfgen::loadGlyph(shape, font, 'A')) {
shape.normalize();
msdfgen::edgeColoringSimple(shape, 3.0);
msdfgen::Bitmap<float, 3> msdf(32, 32);
msdfgen::generateMSDF(msdf, shape, 4.0, 1.0, msdfgen::Vector2(4.0, 4.0));
msdfgen::savePng(msdf, "output.png");
}
msdfgen::destroyFont(font);
}
msdfgen::deinitializeFreetype(ft);
std::cout << "Test" << std::endl; // This should be printed
}
return 0;
}
3 changes: 1 addition & 2 deletions recipes/msdfgen/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")
ttf_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf")
self.run(f"{bin_path} {ttf_path}", run_environment=True)
self.run(bin_path, run_environment=True)

0 comments on commit d6319bd

Please sign in to comment.