private int GetRowIndex(ITestControl testTable, int rowCount, string[] columnCaptions, string[] cellValues){ var gridHelper = new GridControlHelper(testTable); int rowIndex = -1; if (cellValues.Length > 0){ string[,] tableValues = null; List<IGridColumn> columnList = gridHelper.GetColumnIndexes(columnCaptions, false); rowIndex = gridHelper.SearchRowIndex(columnList, cellValues, rowCount, ref tableValues); if (rowIndex == -1) throw new AdapterOperationException( string.Format("The record with the '{0}' value was not found. Checked values: {1}", string.Join(", ", cellValues), GridControlHelper.GetFormatTableValues(tableValues))); } return rowIndex; }
public void Clear() { Stop(); if (VideoWindow != null) { VideoWindow.Visible = 0; } FileValid = false; TestControl = null; MediaControl = null; VideoWindow = null; FilterGraph = null; if (omsdFileName != null) { System.IO.File.Delete(omsdFileName); FileValid = false; } State = ContainerState.CS_Empty; }
public void WorkingWithTasks_() { commandAdapter.DoAction("Navigation", "Task"); commandAdapter.ProcessRecord("Task", new string[] { "Subject" }, new string[] { "Fix breakfast" }, ""); ITestControl control = adapter.CreateTestControl(TestControlType.Table, "Contacts"); IGridBase table = control.GetInterface <IGridBase>(); Assert.AreEqual(0, table.GetRowCount()); commandAdapter.DoAction("Contacts.Link", null); control = adapter.CreateTestControl(TestControlType.Table, "Contact"); control.GetInterface <IGridRowsSelection>().SelectRow(0); commandAdapter.DoAction("OK", null); control = adapter.CreateTestControl(TestControlType.Table, "Contacts"); table = control.GetInterface <IGridBase>(); Assert.AreEqual(1, table.GetRowCount()); Assert.AreEqual("John Nilsen", commandAdapter.GetCellValue("Contacts", 0, "Full Name")); }
protected override void InternalExecute(ICommandAdapter adapter) { var helper = new MultiLineComparisionHelper(); string messageText = null; foreach (Parameter parameter in Parameters) { if (parameter.Name == "Message") { if (messageText == null) { ITestControl testControl = adapter.CreateTestControl(TestControlType.Dialog, ""); messageText = testControl.GetInterface <IControlReadOnlyText>().Text; } string compareResult = helper.Compare("HandleDialog", parameter, messageText, "dialog message"); if (!string.IsNullOrEmpty(compareResult)) { throw new AdapterOperationException(compareResult); } } } if (Parameters["Caption"] != null) { ITestControl testControl = adapter.CreateTestControl(TestControlType.Dialog, ""); string caption = testControl.GetInterface <ITestWindow>().Caption; string compareResult = helper.Compare("HandleDialog", Parameters["Caption"], caption, "dialog caption"); if (!string.IsNullOrEmpty(compareResult)) { throw new AdapterOperationException(compareResult); } } if (Parameters["Respond"] != null) { new ActionCommand().DoAction(adapter, Parameters["Respond"].Value, null); } if (Parameters["Close"] != null && Parameters["Close"].Value == "True") { ITestControl testControl = adapter.CreateTestControl(TestControlType.Dialog, ""); testControl.GetInterface <ITestWindow>().Close(); } }
public bool SetSource(string FileName) { try { FilterGraph = new FilgraphManager(); object ppUnk = null; FilterGraph.AddSourceFilter(FileName, out ppUnk); FilterGraph.RenderFile(FileName); IFilterInfo Info = (IFilterInfo)ppUnk; TestControl = Info.Filter as ITestControl; BasicAudio = FilterGraph as IBasicAudio; VideoWindow = FilterGraph as IVideoWindow; MediaControl = FilterGraph as IMediaControl; } catch (Exception ex) { Clear(); return(false); } return(true); }
private int GetRowIndex(ITestControl testTable, int rowCount, string[] columnCaptions, string[] cellValues) { var gridHelper = new GridControlHelper(testTable); int rowIndex = -1; if (cellValues.Length > 0) { string[,] tableValues = null; List <IGridColumn> columnList = gridHelper.GetColumnIndexes(columnCaptions, false); rowIndex = gridHelper.SearchRowIndex(columnList, cellValues, rowCount, ref tableValues); if (rowIndex == -1) { throw new AdapterOperationException( string.Format("The record with the '{0}' value was not found. Checked values: {1}", string.Join(", ", cellValues), GridControlHelper.GetFormatTableValues(tableValues))); } } return(rowIndex); }
// fill list of directshow filters in FilterGraph void ScanGraph() { activeFilters = null; TestControl = null; if (FilterGraph == null) { return; } DS.IAMCollection coll = FilterGraph.FilterCollection as DS.IAMCollection; if (coll == null) { return; } int c = coll.Count; if (c <= 0) { activeFilters = null; return; } object ppUnk = null; activeFilters = new string[c - 1]; int j = 0; for (int i = c - 1; i >= 0; i--) { coll.Item(i, out ppUnk); DS.IFilterInfo Info = ppUnk as DS.IFilterInfo; if ((Info.Filter as ITestControl) != null) { TestControl = Info.Filter as ITestControl; continue; } activeFilters[j] = Info.Name; j++; } }
public void Clear(bool doStop) { if (doStop) { if (TestControl != null) { TestControl.StopActivity(); } if (MediaControl != null) { if (!UseToTerminate) { MediaControl.Stop(); } } } if (VideoWindow != null) { VideoWindow.Visible = 0; } FileValid = false; TestControl = null; MediaControl = null; VideoWindow = null; try { if (FilterGraph != null) { Marshal.ReleaseComObject(FilterGraph); } } catch (Exception) { } FilterGraph = null; ClearName(); }
private ITestControl GetNavigationTestControl(ICommandAdapter adapter) { string controlNames = ""; for (int i = 0; i < _navigationControlPossibleNames.Length; i++) { if (adapter.IsControlExist(TestControlType.Action, _navigationControlPossibleNames[i])) { try { ITestControl testControl = adapter.CreateTestControl(TestControlType.Action, _navigationControlPossibleNames[i]); IGridBase gridBaseInterface = testControl.GetInterface <IGridBase>(); int itemsCount = gridBaseInterface.GetRowCount(); if (itemsCount > 0) { return(testControl); } } catch (WarningException) { } } controlNames += (i <= _navigationControlPossibleNames.Length) ? _navigationControlPossibleNames[i] + " or " : _navigationControlPossibleNames[i]; } throw new WarningException($"Cannot find the '{controlNames}' control"); }
public void Clear() { if (omsdFileName != null) { FileValid = false; System.IO.File.Delete(omsdFileName); } if (MediaControl != null) { MediaControl.Stop(); } if (VideoWindow != null) { VideoWindow.Visible = 0; VideoWindow.Owner = 0; } TestControl = null; MediaControl = null; VideoWindow = null; BasicAudio = null; FilterGraph = null; }
public ContextMenu(ITestControl testControl) { _testControl = testControl; }
private KeyValuePair<IntPtr, bool> GetWindowHandle(ITestControl activeWindowControl) { var isCustom = false; var screenMainWindow = this.ParameterValue("ScreenMainWindow", false); IntPtr windowHandle = activeWindowControl.GetInterface<ITestWindow>().GetActiveWindowHandle(); if (screenMainWindow) { windowHandle = GetRootWindow(windowHandle.ToInt32()); } Parameter windowNameParameter = Parameters["WindowTitle"]; if (windowNameParameter != null) { isCustom = true; windowHandle = Win32Declares.WindowHandles.FindWindowByCaption(IntPtr.Zero, windowNameParameter.Value); if (windowHandle == IntPtr.Zero) throw new CommandException(String.Format("Cannot find window {0}", windowNameParameter.Value), StartPosition); } return new KeyValuePair<IntPtr, bool>(windowHandle, isCustom); }
protected override void Act(string actionName, int rowIndex, IGridColumn actionColumn, ITestControl testTable) { testTable.GetInterface <IGridAct>().GridAct(actionName, rowIndex, actionColumn); }
protected abstract void Act(string actionName, int rowIndex, IGridColumn actionColumn, ITestControl testTable);
protected override void Act(string actionName, int rowIndex, IGridColumn actionColumn, ITestControl testTable){ testTable.GetInterface<IGridAct>().GridAct(actionName, rowIndex, actionColumn); }
protected abstract void Act(string actionName, int rowIndex, IGridColumn actionColumn, ITestControl testTable);