DummyUI for NAT testing

This commit is contained in:
2021-09-07 11:47:33 -06:00
parent 795f813cfc
commit 0d156bbcc5
2 changed files with 41 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
package test;
import nat.*;
import nat.ArchiveController.ChangeSet;
class DummyUI implements ArchiveUI {
var controller:ArchiveController = null;
public function new() {}
public function setController(controller:ArchiveController) {
this.controller = controller;
}
public function enterText(prompt:String, resolve:(String) -> Void, maxLength:Float) {
// TODO for proper testing, this will need to resolve with specific pre-coded strings
resolve("");
}
public function enterNumber(prompt:String, resolve:(Float) -> Void, min:Float, max:Float, ?inStepsOf:Float) {
// TODO for proper testing, this will need to resolve with specific pre-coded numbers
resolve(min);
}
public function chooseEntry(prompt:String, archive:Archive, resolve:(Entry) -> Void) {
// TODO for proper testing, this will need to resolve with specific pre-coded entries
resolve(null);
}
public function chooseEntries(prompt:String, archive:Archive, resolve:(Array<Entry>) -> Void, min:Int, max:Float) {
// TODO for proper testing, this will need to resolve with specific pre-coded entry lists
resolve([]);
}
public function handleChanges(archive:Archive, changeSet:ChangeSet) {}
public function displayMessage(message:String) {}
public function reportError(error:String) {}
}

View File

@@ -34,6 +34,6 @@
~(wikipedia.queryImageUrls (wikipedia.queryImageTitles ["Phoenix Wright"])))
// TODO make a dummy UI for this, instead of passing null
(let [controller (new ArchiveController archive null)]
(let [controller (new ArchiveController archive (new DummyUI))]
// TODO test controller
0))