Fix test to be runable on other computers.
This commit is contained in:
parent
29156fd52c
commit
0d724ad646
@ -94,13 +94,19 @@ Vec3d calc_hit_point(const igl::Hit &h, indexed_triangle_set &its)
|
|||||||
}
|
}
|
||||||
} // namespace Private
|
} // namespace Private
|
||||||
|
|
||||||
#include "imgui/imstb_truetype.h"
|
std::string get_font_filepath() {
|
||||||
TEST_CASE("Emboss text - Times MacOs", "[Emboss]") {
|
std::string resource_dir =
|
||||||
|
std::string(TEST_DATA_DIR) + "/../../resources/";
|
||||||
|
return resource_dir + "fonts/NotoSans-Regular.ttf";
|
||||||
|
}
|
||||||
|
|
||||||
std::string font_path = "C:/Users/filip/Downloads/Times.ttc";
|
#include "imgui/imstb_truetype.h"
|
||||||
//std::string font_path = "//System/Library/Fonts/Times.ttc";
|
TEST_CASE("Read glyph C shape from font, stb library calls ONLY", "[Emboss]") {
|
||||||
|
std::string font_path = get_font_filepath();
|
||||||
char letter = 'C';
|
char letter = 'C';
|
||||||
float flatness = 2.;
|
float flatness = 2.;
|
||||||
|
|
||||||
|
// Read font file
|
||||||
FILE *file = fopen(font_path.c_str(), "rb");
|
FILE *file = fopen(font_path.c_str(), "rb");
|
||||||
REQUIRE(file != nullptr);
|
REQUIRE(file != nullptr);
|
||||||
// find size of file
|
// find size of file
|
||||||
@ -111,6 +117,8 @@ TEST_CASE("Emboss text - Times MacOs", "[Emboss]") {
|
|||||||
std::vector<unsigned char> buffer(size);
|
std::vector<unsigned char> buffer(size);
|
||||||
size_t count_loaded_bytes = fread((void *) &buffer.front(), 1, size, file);
|
size_t count_loaded_bytes = fread((void *) &buffer.front(), 1, size, file);
|
||||||
REQUIRE(count_loaded_bytes == size);
|
REQUIRE(count_loaded_bytes == size);
|
||||||
|
|
||||||
|
// Use stb true type library
|
||||||
int font_offset = stbtt_GetFontOffsetForIndex(buffer.data(), 0);
|
int font_offset = stbtt_GetFontOffsetForIndex(buffer.data(), 0);
|
||||||
REQUIRE(font_offset >= 0);
|
REQUIRE(font_offset >= 0);
|
||||||
stbtt_fontinfo font_info;
|
stbtt_fontinfo font_info;
|
||||||
@ -124,10 +132,9 @@ TEST_CASE("Emboss text - Times MacOs", "[Emboss]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <libslic3r/Utils.hpp>
|
#include <libslic3r/Utils.hpp>
|
||||||
TEST_CASE("Emboss text", "[Emboss]")
|
TEST_CASE("Convert glyph % to model", "[Emboss]")
|
||||||
{
|
{
|
||||||
std::string resource_dir = std::string(TEST_DATA_DIR) + "/../../resources/";
|
std::string font_path = get_font_filepath();
|
||||||
std::string font_path = resource_dir + "fonts/NotoSans-Regular.ttf";
|
|
||||||
char letter = '%';
|
char letter = '%';
|
||||||
float flatness = 2.;
|
float flatness = 2.;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user