Removed Chinese support (messed with root). Fixed tests.

This commit is contained in:
Michael Griebling
2024-10-05 10:45:03 -04:00
parent cfc0e75715
commit 2809379401
4 changed files with 27 additions and 27 deletions

View File

@@ -528,11 +528,11 @@ public class MTMathAtomFactory {
case "\u{0410}"..."\u{044F}": case "\u{0410}"..."\u{044F}":
return MTMathAtom(type: .ordinary, value: chStr) return MTMathAtom(type: .ordinary, value: chStr)
case _ where ch.utf32Char < 0x0021 || ch.utf32Char > 0x007E: case _ where ch.utf32Char < 0x0021 || ch.utf32Char > 0x007E:
// allow Chinese characters for testing // // allow Chinese characters for testing
if ((ch.utf32Char >= 0x4E00) && (ch.utf32Char <= 0x9FFF)) { // if ((ch.utf32Char >= 0x4E00) && (ch.utf32Char <= 0x9FFF)) {
// CJK support. But xits-math-cn font only has Chinese characters support. // // CJK support. But xits-math-cn font only has Chinese characters support.
return MTMathAtom(type:.ordinary, value:chStr) // return MTMathAtom(type:.ordinary, value:chStr)
} // }
return nil return nil
case "$", "%", "#", "&", "~", "\'", "^", "_", "{", "}", "\\": case "$", "%", "#", "&", "~", "\'", "^", "_", "{", "}", "\\":
return nil return nil

View File

@@ -29,9 +29,9 @@ final class ConcurrencyThreadsafeTests: XCTestCase {
XCTAssertNotNil(result4) XCTAssertNotNil(result4)
} }
} }
executionGroup.notify(queue: .main) { [weak self] in // executionGroup.notify(queue: .main) { [weak self] in
// print("All test cases completed: \(self?.testCount ?? 0)") // // print("All test cases completed: \(self?.testCount ?? 0)")
} // }
executionGroup.wait() executionGroup.wait()
} }
func helperConcurrency(_ count: Int, in group: DispatchGroup, on queue: DispatchQueue, _ testClosure: @escaping () -> (Void)) { func helperConcurrency(_ count: Int, in group: DispatchGroup, on queue: DispatchQueue, _ testClosure: @escaping () -> (Void)) {

View File

@@ -47,14 +47,14 @@ final class MTFontMathTableV2Tests: XCTestCase {
func helperConcurrentMTFontMathTableV2(_ count: Int, mtfont: MTFontV2, in group: DispatchGroup, on queue: DispatchQueue) { func helperConcurrentMTFontMathTableV2(_ count: Int, mtfont: MTFontV2, in group: DispatchGroup, on queue: DispatchQueue) {
let workitem = DispatchWorkItem { let workitem = DispatchWorkItem {
let mTable = mtfont.mathTable let mTable = mtfont.mathTable
let values = [ // let values = [
mTable?.fractionNumeratorDisplayStyleShiftUp, // mTable?.fractionNumeratorDisplayStyleShiftUp,
mTable?.fractionNumeratorShiftUp, // mTable?.fractionNumeratorShiftUp,
mTable?.fractionDenominatorDisplayStyleShiftDown, // mTable?.fractionDenominatorDisplayStyleShiftDown,
mTable?.fractionDenominatorShiftDown, // mTable?.fractionDenominatorShiftDown,
mTable?.fractionNumeratorDisplayStyleGapMin, // mTable?.fractionNumeratorDisplayStyleGapMin,
mTable?.fractionNumeratorGapMin, // mTable?.fractionNumeratorGapMin,
].compactMap{$0} // ].compactMap{$0}
// if count % 50 == 0 { // if count % 50 == 0 {
// print(values) // accessed these values on global thread. // print(values) // accessed these values on global thread.
// } // }
@@ -64,14 +64,14 @@ final class MTFontMathTableV2Tests: XCTestCase {
// print("\(Thread.isMainThread ? "main" : "global") completed .....") // print("\(Thread.isMainThread ? "main" : "global") completed .....")
let mTable = mtfont.mathTable let mTable = mtfont.mathTable
if count % 70 == 0 { if count % 70 == 0 {
let values = [ // let values = [
mTable?.fractionNumeratorDisplayStyleShiftUp, // mTable?.fractionNumeratorDisplayStyleShiftUp,
mTable?.fractionNumeratorShiftUp, // mTable?.fractionNumeratorShiftUp,
mTable?.fractionDenominatorDisplayStyleShiftDown, // mTable?.fractionDenominatorDisplayStyleShiftDown,
mTable?.fractionDenominatorShiftDown, // mTable?.fractionDenominatorShiftDown,
mTable?.fractionNumeratorDisplayStyleGapMin, // mTable?.fractionNumeratorDisplayStyleGapMin,
mTable?.fractionNumeratorGapMin, // mTable?.fractionNumeratorGapMin,
].compactMap{$0} // ].compactMap{$0}
// if count % 50 == 0 { // if count % 50 == 0 {
// print(values) // print(values)
// } // }

View File

@@ -40,7 +40,7 @@ final class MathImageTests: XCTestCase {
XCTAssertNotNil(result.image) XCTAssertNotNil(result.image)
if result.error == nil, let image = result.image, let imageData = image.pngData() { if result.error == nil, let image = result.image, let imageData = image.pngData() {
safeImage(fileName: "\(caseNumber)", pngData: imageData) safeImage(fileName: "\(caseNumber)", pngData: imageData)
let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory()) //let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory())
print("completed image-\(caseNumber).png") print("completed image-\(caseNumber).png")
} }
default: default:
@@ -49,7 +49,7 @@ final class MathImageTests: XCTestCase {
XCTAssertNotNil(result.image) XCTAssertNotNil(result.image)
if result.error == nil, let image = result.image, let imageData = image.pngData() { if result.error == nil, let image = result.image, let imageData = image.pngData() {
safeImage(fileName: "\(caseNumber)", pngData: imageData) safeImage(fileName: "\(caseNumber)", pngData: imageData)
let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory()) //let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory())
print("completed image-\(caseNumber).png") print("completed image-\(caseNumber).png")
} }
} }
@@ -77,7 +77,7 @@ final class MathImageTests: XCTestCase {
} }
executionGroup.notify(queue: .main) { [weak self] in executionGroup.notify(queue: .main) { [weak self] in
let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory()) let fileUrl = URL(fileURLWithPath: NSTemporaryDirectory())
print("\(self?.testCount)/\(self?.totalCases) completed, check \(fileUrl.path) ===") print("\(self!.testCount)/\(self!.totalCases) completed, check \(fileUrl.path) ===")
XCTAssertEqual(self?.testCount,self?.totalCases) XCTAssertEqual(self?.testCount,self?.totalCases)
} }
executionGroup.wait() executionGroup.wait()