private void Awake() { InputData inputData = new InputData(); inputWriter = new InputWriter(inputData); inputReader = new InputReader(inputData); }
/// <summary> /// Writes the input. /// </summary> /// <param name="input">The input.</param> public void WriteInput(string input) { if (IsProcessRunning && InputWriter is not null) { InputWriter.WriteLine(input); InputWriter.Flush(); } }
protected override Task GivenAsync(CancellationToken cancellationToken) { return(Task.Run(() => { _inputWriter = new InputWriter(); _inputWriter.OnOutput += TestOutputHelper.Write; }, cancellationToken)); }
private void DestroyWriter() { //Debug.LogError("Call DestroyWriter " + (currentInputWriter == null)); if (currentInputWriter != null) { currentInputWriter.Finish(); currentInputWriter = null; Controller.EndWriting(); } }
private InputWriter CreateTouchWriter(IEventSystemHandler handler) { if (currentInputWriter != null) { DestroyWriter(); } if (recordExecuteEvent.SkipSendTouch) { return(null); } var selectable = handler as Selectable; if (selectable != null && !selectable.interactable) { return(null); } var selectGameObject = (handler as Component).gameObject; if (selectGameObject.tag == "SkipRecord") { return(null); } Controller.WriteDelay(); var isDrag = handler is ScrollRect; var currentDragSessionName = (isDrag ? "Drag_" : "Click_") + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + selectGameObject.name + ".txt"; var currentDragSessionPath = Path.Combine(PathFileTarget, currentDragSessionName); Controller.WriteScript((isDrag ? "--drag " : "--click ") + selectGameObject.name); Controller.WriteScript("coroutine.yield(MouseInput(\"" + selectGameObject.name + "\", \"" + currentDragSessionName + "\"));" + Environment.NewLine); currentInputWriter = new TouchWriter(); currentInputWriter.StartWriter(selectGameObject, currentDragSessionPath); Controller.BeginWrite(); return(currentInputWriter); }
private InputWriter CreateKeyboardWriter(InputField inputField) { if (currentInputWriter != null) { DestroyWriter(); } Controller.WriteDelay(); var selectGameObject = inputField.gameObject; var currentDragSessionName = "Keyboard_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + selectGameObject.name + ".txt"; var currentDragSessionPath = Path.Combine(PathFileTarget, currentDragSessionName); Controller.WriteScript("--select input field " + selectGameObject.name); Controller.WriteScript("coroutine.yield(KeyboardInput(\"" + currentDragSessionName + "\"));" + Environment.NewLine); currentInputWriter = new KeyboardWriter(); currentInputWriter.StartWriter(selectGameObject, currentDragSessionPath); Controller.BeginWrite(); return(currentInputWriter); }
protected override void Given() { _inputWriter = new InputWriter(); _inputWriter.OnOutput += TestOutputHelper.Write; }