Sync source edition with VCC Plus 3.7.0 build 63
This commit is contained in:
1 parent
c652a5276d
commit
b2ecec4d87
86 files changed
+10519
-472
No files matched your search
@@ -40,6 +40,20 @@ final class SoftwareLibraryLaunchPlanTests: XCTestCase {
|
||||
XCTAssertFalse(automatic(release(media: "hard-disk", profile: "hard-drive-basic", paths: [("hardDisk0", "GAME.vhd")], command: "DOS\r")))
|
||||
XCTAssertFalse(automatic(release(paths: [("disk0", "GAME.vhd")], command: "DOS\r")))
|
||||
}
|
||||
func testUnconfiguredPersonalROMImportOffersRealCartridgeSetup() async throws {
|
||||
let selected = root.appendingPathComponent("AUTHORED.ROM"), bytes = Data([0x12,0x39])
|
||||
try bytes.write(to: selected)
|
||||
let store = PersonalSoftwareLibraryStore(root: root.appendingPathComponent("PersonalLibrary"))
|
||||
let draft = try await store.inspect([selected]), entry = try await store.save(draft)
|
||||
XCTAssertFalse(entry.configured)
|
||||
let imported = await store.directory(for: entry.id)
|
||||
let plan = try SoftwareLibraryLaunchPlan.prepare(release: entry.release(in: imported), receipt: entry.receipt(in: imported))
|
||||
XCTAssertEqual(plan.profile, .romCartridge)
|
||||
XCTAssertEqual(plan.cartridgeURL?.lastPathComponent, "AUTHORED.ROM")
|
||||
XCTAssertTrue(plan.commands.isEmpty)
|
||||
XCTAssertEqual(try Data(contentsOf: selected), bytes)
|
||||
try plan.validateMedia()
|
||||
}
|
||||
func testCartridgeAutostartsWithoutTypingAndHonorsItsStartupSlot() throws {
|
||||
try file("GAME.ccc")
|
||||
let plan = try SoftwareLibraryLaunchPlan.prepare(release: release(media: "cartridge", profile: "rom-cartridge", paths: [("cartridge", "GAME.ccc")], extra: ["cartridge_slot": .number(2)]), receipt: receipt(["GAME.ccc"]))
|
||||
@@ -186,4 +200,53 @@ final class SoftwareLibraryLaunchPlanTests: XCTestCase {
|
||||
XCTAssertNil(SoftwareLibraryLaunchPlan.decodeCommands(command), command)
|
||||
}
|
||||
}
|
||||
|
||||
func testBasicProgramLoadThenRunUsesSeparateKeyboardLines() throws {
|
||||
for sequence in ["LOAD \"POPSTAR\"\nRUN", "load \"POPSTAR\"\r\nrun", "LOAD\"POPSTAR\"\\rRUN\\r"] {
|
||||
let commands = try XCTUnwrap(SoftwareLibraryLaunchPlan.decodeCommands(sequence))
|
||||
XCTAssertEqual(commands.count, 2)
|
||||
XCTAssertEqual(commands[0].uppercased().replacingOccurrences(of: " ", with: ""), "LOAD\"POPSTAR\"")
|
||||
XCTAssertEqual(commands[1].uppercased(), "RUN")
|
||||
}
|
||||
try file("POPSTAR.DSK")
|
||||
let item = release(paths: [("disk0", "POPSTAR.DSK")], command: "LOAD \"POPSTAR\"\nRUN", status: "manual-setup")
|
||||
XCTAssertTrue(SoftwareLibraryLaunchPlan.hasAutomaticStartup(for: item))
|
||||
let plan = try SoftwareLibraryLaunchPlan.prepare(release: item, receipt: receipt(["POPSTAR.DSK"]))
|
||||
XCTAssertTrue(plan.automaticallyStarts)
|
||||
XCTAssertEqual(plan.commands, ["LOAD \"POPSTAR\"", "RUN"])
|
||||
XCTAssertEqual(plan.floppyURLs[0]?.lastPathComponent, "POPSTAR.DSK")
|
||||
XCTAssertNil(SoftwareLibraryLaunchPlan.decodeCommands("LOAD \"POPSTAR\":RUN"), "BASIC discards the rest of the LOAD command line")
|
||||
XCTAssertEqual(SoftwareLibraryLaunchPlan.decodeCommands("LOAD \"POPSTAR\""), ["LOAD \"POPSTAR\""])
|
||||
XCTAssertFalse(SoftwareLibraryLaunchPlan.hasAutomaticStartup(for: release(paths: [("disk0", "POPSTAR.DSK")], command: "LOAD \"POPSTAR\"")))
|
||||
XCTAssertNil(SoftwareLibraryLaunchPlan.decodeCommands("LOAD \"POPSTAR\"\nRUN\nDIR"), "No later commands may be typed into a started guest program")
|
||||
}
|
||||
@MainActor
|
||||
func testReviewedPersonalDiskOffersPlayWithoutLoadingCommands() throws {
|
||||
try file("GAME.DSK")
|
||||
var entry = PersonalSoftwareEntry(id: UUID(), title: "Reviewed personal disk", files: [
|
||||
.init(path: "GAME.DSK", kind: "disk", byteSize: 3, sha256: sha, role: "disk0")
|
||||
])
|
||||
entry.configured = true
|
||||
let item = entry.release(in: root)
|
||||
XCTAssertTrue(SoftwareLibraryLaunchPlan.hasPlayAction(for: item))
|
||||
XCTAssertFalse(SoftwareLibraryLaunchPlan.hasAutomaticStartup(for: item))
|
||||
let plan = try SoftwareLibraryLaunchPlan.prepare(release: item, receipt: entry.receipt(in: root))
|
||||
XCTAssertTrue(plan.offersPlay); XCTAssertFalse(plan.automaticallyStarts)
|
||||
XCTAssertTrue(plan.commands.isEmpty); XCTAssertNotNil(plan.floppyURLs[0])
|
||||
let model = SoftwareLibraryModel(state: .init(directory: root.appendingPathComponent("State")))
|
||||
XCTAssertEqual(model.launchLabel(item, installed: true), "Play…")
|
||||
XCTAssertEqual(model.launchSymbol(item), "play.fill")
|
||||
entry.command = "LOAD \"GAME\""
|
||||
let loadOnly = try SoftwareLibraryLaunchPlan.prepare(release: entry.release(in: root), receipt: entry.receipt(in: root))
|
||||
XCTAssertTrue(loadOnly.offersPlay); XCTAssertFalse(loadOnly.automaticallyStarts)
|
||||
XCTAssertEqual(loadOnly.commands, ["LOAD \"GAME\""])
|
||||
entry.command = "SYSTEM \"curl example.invalid\""
|
||||
let unsupported = try SoftwareLibraryLaunchPlan.prepare(release: entry.release(in: root), receipt: entry.receipt(in: root))
|
||||
XCTAssertTrue(unsupported.offersPlay); XCTAssertTrue(unsupported.commands.isEmpty)
|
||||
entry.configured = false
|
||||
XCTAssertFalse(SoftwareLibraryLaunchPlan.hasPlayAction(for: entry.release(in: root)))
|
||||
entry.configured = true; entry.files[0].role = ""
|
||||
XCTAssertFalse(SoftwareLibraryLaunchPlan.hasPlayAction(for: entry.release(in: root)))
|
||||
XCTAssertFalse(SoftwareLibraryLaunchPlan.hasPlayAction(for: release(paths: [("disk0", "GAME.DSK")])), "Public catalog labels retain their existing behavior")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user