Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ios): fix HippyFontLoaderTest using local file
Browse files Browse the repository at this point in the history
Cyunong committed Nov 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 3569002 commit bf35d95
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions hippy.podspec
Original file line number Diff line number Diff line change
@@ -365,6 +365,7 @@ Pod::Spec.new do |s|

s.test_spec 'UnitTests' do |test_spec|
test_spec.source_files = 'tests/ios/**/*.{h,m,mm}'
test_spec.resources = 'framework/examples/ios-demo/fonts/TTTGB-Medium.otf'
test_spec.dependency 'OCMock'
end

13 changes: 4 additions & 9 deletions tests/ios/HippyFontLoaderTest.m
Original file line number Diff line number Diff line change
@@ -44,8 +44,10 @@ - (void)tearDown {
- (void)testHippyFontLoaderModule {
NSString* invalidURL = @"https://example.url";
// set arbitrary valid font file url
NSString* validURL = @"https://zf.sc.chinaz.com/Files/DownLoad/upload/2024/1009/hanyihuaxianzijianti.ttf";
NSString* fontFamily = @"HYHuaXianZi J";
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString* filePath = [testBundle pathForResource:@"TTTGB-Medium" ofType:@"otf"];
NSString* validURL = [@"file://" stringByAppendingString:filePath];
NSString* fontFamily = @"TTTGB Medium";
HippyBridge *bridge = [[HippyBridge alloc] initWithDelegate:nil moduleProvider:nil launchOptions:nil executorKey:nil];
HippyFontLoaderModule *fontLoader = [[HippyFontLoaderModule alloc] init];
[fontLoader setValue:bridge forKey:@"bridge"];
@@ -109,11 +111,4 @@ - (void)testHippyFontLoaderModule {
[[NSFileManager defaultManager] removeItemAtPath:[fontPath stringByDeletingLastPathComponent] error:nil];
}

- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}

@end

0 comments on commit bf35d95

Please sign in to comment.