Skip to content

Commit 51a6cce

Browse files
committed
Fix font getter
1 parent 0fa80cb commit 51a6cce

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ShapeScript/StandardLibrary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ extension Dictionary where Key == String, Value == Symbol {
266266
"font": .property(.font, { parameter, context in
267267
context.font = parameter.stringValue
268268
}, { context in
269-
.texture(context.material.texture)
269+
.string(context.font)
270270
}),
271271
// Debug
272272
"print": .command(.tuple) { value, context in

ShapeScriptTests/InterpreterTests.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,16 @@ class InterpreterTests: XCTestCase {
921921
XCTAssertEqual(context.font, "Courier")
922922
}
923923

924+
func testGetValidFont() throws {
925+
let program = """
926+
font "Courier"
927+
print font
928+
"""
929+
let delegate = TestDelegate()
930+
XCTAssertNoThrow(try evaluate(parse(program), delegate: delegate))
931+
XCTAssertEqual(delegate.log, ["Courier"])
932+
}
933+
924934
func testSetValidFontWithStringInterpolation() throws {
925935
let program = try parse("font (\"Cou\" \"rier\")")
926936
let context = EvaluationContext(source: program.source, delegate: nil)

0 commit comments

Comments
 (0)