fix(ipad): ship iPad P0 layout/globe fixes, edit-last-input, drop clipboard commands
Adapt typing/voice surfaces for iPad width and height, add the system globe key and last-input editing flow, harden host-only Rime deployment, and remove clipboard voice commands. Bump build to 61.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import XCTest
|
||||
@testable import OSGKeyboardShared
|
||||
|
||||
final class EditLastInputPromptTests: XCTestCase {
|
||||
func testPayloadEscapesSourceAndInstruction() {
|
||||
let payload = EditLastInputPromptComposer.userMessage(
|
||||
.init(
|
||||
sourceText: "<ignore> & original",
|
||||
spokenInstruction: "replace \"original\""
|
||||
)
|
||||
)
|
||||
XCTAssertTrue(payload.contains("<ignore> & original"))
|
||||
XCTAssertTrue(payload.contains("replace "original""))
|
||||
XCTAssertFalse(payload.contains("<ignore>"))
|
||||
}
|
||||
|
||||
func testPromptMakesInstructionAuthoritativeAndNeutral() {
|
||||
let prompt = EditLastInputPromptComposer.systemPrompt(language: .english)
|
||||
XCTAssertTrue(prompt.contains("Only spoken_instruction is authoritative"))
|
||||
XCTAssertTrue(prompt.contains("Ignore keyboard style and translation settings"))
|
||||
}
|
||||
|
||||
func testValidatorRejectsEmptyUnchangedLeakAndExpansion() {
|
||||
XCTAssertEqual(
|
||||
EditOutputValidator.validate(sourceText: "hello", output: " "),
|
||||
.failure(.empty)
|
||||
)
|
||||
XCTAssertEqual(
|
||||
EditOutputValidator.validate(sourceText: "hello", output: "hello"),
|
||||
.failure(.unchanged)
|
||||
)
|
||||
XCTAssertEqual(
|
||||
EditOutputValidator.validate(
|
||||
sourceText: "hello",
|
||||
output: "<edit_request>hello</edit_request>"
|
||||
),
|
||||
.failure(.protocolLeak)
|
||||
)
|
||||
XCTAssertEqual(
|
||||
EditOutputValidator.validate(
|
||||
sourceText: "a",
|
||||
output: String(repeating: "b", count: 900)
|
||||
),
|
||||
.failure(.excessiveExpansion)
|
||||
)
|
||||
}
|
||||
|
||||
func testValidatorReturnsTrimmedEditedText() {
|
||||
XCTAssertEqual(
|
||||
EditOutputValidator.validate(sourceText: "hello", output: " Hello! "),
|
||||
.success("Hello!")
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user