Skip to content

Commit

Permalink
fix(ios): fix HippyFontLoaderTest using local file
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyunong committed Nov 12, 2024
1 parent 3569002 commit bf35d95
Show file tree
Hide file tree
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
Expand Up @@ -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

Expand Down
13 changes: 4 additions & 9 deletions tests/ios/HippyFontLoaderTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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.