1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 11:37:32 +03:00

chore: avoid crash in xcode 13.1

This commit is contained in:
solawing 2021-10-30 12:46:44 +08:00
parent 7f814e1bfb
commit 918fc44889

View File

@ -432,34 +432,41 @@ class TypesetterWithLigaturesTest: XCTestCase {
) )
expect(runs).to(haveCount(4)) expect(runs).to(haveCount(4))
// The positions of the combining characters are copied from print outputs // newest xcode(13.1) will crash at the follwing code, by use var run, and call expect(run.positions[0]). avoid crash
// and they are visually checked by drawing them and inspecting them... do {
var run = runs[0] // The positions of the combining characters are copied from print outputs
expect(run.font).to(equalFont(courierNew)) // and they are visually checked by drawing them and inspecting them...
expect(run.glyphs).to(haveCount(2)) let run = runs[0]
expect(run.positions[0]) expect(run.font).to(equalFont(courierNew))
.to(equal(CGPoint(x: offset.x + 1 * defaultWidth, y: offset.y))) expect(run.glyphs).to(haveCount(2))
expect(run.positions[1].x) expect(run.positions[0])
.to(beCloseTo(offset.x + 1 * defaultWidth + 0.003, within: 0.001)) .to(equal(CGPoint(x: offset.x + 1 * defaultWidth, y: offset.y)))
expect(run.positions[1].y).to(beCloseTo(offset.y + 0.305, within: 0.001)) expect(run.positions[1].x)
.to(beCloseTo(offset.x + 1 * defaultWidth + 0.003, within: 0.001))
expect(run.positions[1].y).to(beCloseTo(offset.y + 0.305, within: 0.001))
}
run = runs[1] do {
expect(run.font).to(equalFont(defaultFont)) let run = runs[1]
expect(run.glyphs).to(haveCount(2)) expect(run.font).to(equalFont(defaultFont))
expect(run.positions[0]) expect(run.glyphs).to(haveCount(2))
.to(equal(CGPoint(x: offset.x + 2 * defaultWidth, y: offset.y))) expect(run.positions[0])
expect(run.positions[1].x) .to(equal(CGPoint(x: offset.x + 2 * defaultWidth, y: offset.y)))
.to(beCloseTo(offset.x + 2 * defaultWidth, within: 0.001)) expect(run.positions[1].x)
expect(run.positions[1].y).to(beCloseTo(offset.y - 0.279, within: 0.001)) .to(beCloseTo(offset.x + 2 * defaultWidth, within: 0.001))
expect(run.positions[1].y).to(beCloseTo(offset.y - 0.279, within: 0.001))
}
run = runs[2] do {
expect(run.font).to(equalFont(monaco)) let run = runs[2]
expect(run.glyphs).to(haveCount(2)) expect(run.font).to(equalFont(monaco))
expect(run.positions[0]) expect(run.glyphs).to(haveCount(2))
.to(equal(CGPoint(x: offset.x + 3 * defaultWidth, y: offset.y))) expect(run.positions[0])
expect(run.positions[1].x) .to(equal(CGPoint(x: offset.x + 3 * defaultWidth, y: offset.y)))
.to(beCloseTo(offset.x + 3 * defaultWidth + 7.804, within: 0.001)) expect(run.positions[1].x)
expect(run.positions[1].y).to(beCloseTo(offset.y + 2.446, within: 0.001)) .to(beCloseTo(offset.x + 3 * defaultWidth + 7.804, within: 0.001))
expect(run.positions[1].y).to(beCloseTo(offset.y + 2.446, within: 0.001))
}
self.assertEmojiMarker(run: runs[3], xPosition: offset.x + 4 * defaultWidth) self.assertEmojiMarker(run: runs[3], xPosition: offset.x + 4 * defaultWidth)
} }