void CreateCheckFilteringDemoActions() { AddLoadModuleActions(typeof(Filtering)); AddSimpleAction(delegate() { Assert.IsTrue((bool)FilteringModule.allowFilterEditor.IsChecked); Assert.IsTrue((bool)FilteringModule.allowFilteringCheckEdit.IsChecked); Assert.AreEqual(0, FilteringModule.showFilterPanelModeListBox.SelectedIndex); Assert.AreEqual(0, FilteringModule.viewsListBox.SelectedIndex); Assert.AreEqual(DevExpress.Xpf.Grid.ShowFilterPanelMode.Default, View.ShowFilterPanelMode); FilteringModule.showFilterPanelModeListBox.SelectedIndex = 1; UpdateLayoutAndDoEvents(); Assert.AreEqual(DevExpress.Xpf.Grid.ShowFilterPanelMode.ShowAlways, View.ShowFilterPanelMode); DevExpress.Xpf.Grid.GridColumn column = FilteringModule.colCountry; Assert.AreEqual(DefaultBoolean.Default, column.AllowColumnFiltering); Assert.AreEqual(DefaultBoolean.Default, column.AllowColumnFiltering); CheckEdit updateImmediatelyCheckBox = FilteringModule.immediateUpdateCountryColumnFilterCheckEdit; Assert.AreEqual(true, updateImmediatelyCheckBox.IsChecked); Assert.AreEqual(true, column.ImmediateUpdateColumnFilter); EditorsActions.ToggleCheckEdit(updateImmediatelyCheckBox); Assert.AreEqual(false, column.ImmediateUpdateColumnFilter); EditorsActions.ToggleCheckEdit(updateImmediatelyCheckBox); Assert.AreEqual(true, column.ImmediateUpdateColumnFilter); FilteringModule.showFilterPanelModeListBox.SelectedIndex = 2; UpdateLayoutAndDoEvents(); Assert.AreEqual(DevExpress.Xpf.Grid.ShowFilterPanelMode.Never, View.ShowFilterPanelMode); FilteringModule.viewsListBox.SelectedIndex = 1; UpdateLayoutAndDoEvents(); Assert.AreEqual(typeof(DevExpress.Xpf.Grid.CardView), CardView.GetType()); }); }
void CreateCheckMultiColumnReportModuleActions() { AddLoadModuleActions(typeof(MultiColumnModule)); foreach (PageNumberKind pageNumberKind in (System.Collections.IEnumerable)DispatchExpr(() => ColumnReportModule.pageNumberKindEdit.ItemsSource)) { IAmAlive("Changing the number kind"); PageNumberKind temp_pageNumberKind = pageNumberKind; Dispatch(() => { ColumnReportModule.pageNumberKindEdit.EditValue = temp_pageNumberKind; }); WaitDocumentBuildCompleted(); foreach (HorizontalAlignment pageNumberAlignment in (System.Collections.IEnumerable)DispatchExpr(() => ColumnReportModule.pageNumberAlignmentEdit.ItemsSource)) { HorizontalAlignment temp_pageNumberAlignment = pageNumberAlignment; Dispatch(() => { ColumnReportModule.pageNumberAlignmentEdit.EditValue = temp_pageNumberAlignment; }); WaitDocumentBuildCompleted(); foreach (PageNumberLocation pageNumberLocation in (System.Collections.IEnumerable)DispatchExpr(() => ColumnReportModule.pageNumberLocationEdit.ItemsSource)) { PageNumberLocation temp_pageNumberLocation = pageNumberLocation; Dispatch(() => { ColumnReportModule.pageNumberLocationEdit.EditValue = temp_pageNumberLocation; }); WaitDocumentBuildCompleted(); } } } Dispatch(() => { ColumnReportModule.downThenAcross.IsChecked = true; }); WaitDocumentBuildCompleted(); Dispatch(() => { ColumnReportModule.acrossThenDown.IsChecked = true; }); WaitDocumentBuildCompleted(); Dispatch(() => { EditorsActions.SetEditValue(ColumnReportModule.pageNumberFormatEdit, "Page {test}"); }); WaitDocumentBuildCompleted(); }
void RowColumnLayoutTest() { ResetDockLayoutManager(); Assert.AreEqual(3, DockLayoutManager.LayoutRoot.Items.Count); Assert.IsTrue(DockLayoutManager.LayoutRoot.Orientation == System.Windows.Controls.Orientation.Horizontal); Assert.IsTrue(RowColumnLayoutModule.allowSplittersCheck.IsChecked.Value); Assert.AreEqual(0, RowColumnLayoutModule.orientationListBox.SelectedIndex); Assert.IsTrue(DockLayoutManager.LayoutRoot.IsSplittersEnabled); EditorsActions.ToggleCheckEdit(RowColumnLayoutModule.allowSplittersCheck); UpdateLayoutAndDoEvents(); Assert.IsFalse(DockLayoutManager.LayoutRoot.IsSplittersEnabled); EditorsActions.ToggleCheckEdit(RowColumnLayoutModule.allowSplittersCheck); UpdateLayoutAndDoEvents(); Assert.IsTrue(DockLayoutManager.LayoutRoot.IsSplittersEnabled); RowColumnLayoutModule.orientationListBox.SelectedIndex = 1; UpdateLayoutAndDoEvents(); Assert.AreEqual(1, RowColumnLayoutModule.orientationListBox.SelectedIndex); Assert.IsTrue(DockLayoutManager.LayoutRoot.Orientation == System.Windows.Controls.Orientation.Vertical); RowColumnLayoutModule.orientationListBox.SelectedIndex = 0; UpdateLayoutAndDoEvents(); Assert.AreEqual(0, RowColumnLayoutModule.orientationListBox.SelectedIndex); Assert.IsTrue(DockLayoutManager.LayoutRoot.Orientation == System.Windows.Controls.Orientation.Horizontal); }
void CreateCheckFilterControlDemoActions() { AddLoadModuleActions(typeof(FilterControl)); AddSimpleAction(delegate() { Assert.IsTrue(View.AllowFilterEditor); CriteriaOperator filterCriteria = new BinaryOperator("OrderID", 10248, BinaryOperatorType.Equal); Assert.AreEqual(filterCriteria, FilterControlModule.filterEditor.FilterCriteria); Assert.AreEqual(filterCriteria, GridControl.FilterCriteria); Assert.AreEqual(false, FilterControlModule.showGroupCommandsIcon.IsChecked); Assert.AreEqual(false, FilterControlModule.showOperandTypeIcon.IsChecked); Assert.AreEqual(true, FilterControlModule.showToolTips.IsChecked); Assert.IsFalse(FilterControlModule.filterEditor.ShowGroupCommandsIcon); Assert.IsFalse(FilterControlModule.filterEditor.ShowOperandTypeIcon); Assert.IsTrue(FilterControlModule.filterEditor.ShowToolTips); EditorsActions.ToggleCheckEdit(FilterControlModule.showGroupCommandsIcon); UpdateLayoutAndDoEvents(); Assert.IsTrue(FilterControlModule.filterEditor.ShowGroupCommandsIcon); EditorsActions.ToggleCheckEdit(FilterControlModule.showOperandTypeIcon); UpdateLayoutAndDoEvents(); Assert.IsTrue(FilterControlModule.filterEditor.ShowOperandTypeIcon); EditorsActions.ToggleCheckEdit(FilterControlModule.showToolTips); UpdateLayoutAndDoEvents(); Assert.IsFalse(FilterControlModule.filterEditor.ShowToolTips); filterCriteria = new BinaryOperator("OrderID", 10249L, BinaryOperatorType.Equal); FilterControlModule.filterEditor.FilterCriteria = filterCriteria; UpdateLayoutAndDoEvents(); UIAutomationActions.ClickButton(FilterControlModule.ApplyFilterButton); Assert.AreEqual(filterCriteria, GridControl.FilterCriteria); filterCriteria = new BinaryOperator("OrderID", 10250L, BinaryOperatorType.Equal); GridControl.FilterCriteria = filterCriteria; UpdateLayoutAndDoEvents(); Assert.AreEqual(filterCriteria, FilterControlModule.filterEditor.FilterCriteria); View.FilterEditorCreated += new DevExpress.Xpf.Grid.FilterEditorEventHandler(View_FilterEditorCreated); View.ShowFilterEditor(null); UpdateLayoutAndDoEvents(); Assert.IsNotNull(FilterEditorFromGrid); Assert.IsTrue(FilterEditorFromGrid.ShowGroupCommandsIcon); Assert.IsTrue(FilterEditorFromGrid.ShowOperandTypeIcon); Assert.IsFalse(FilterEditorFromGrid.ShowToolTips); DialogControl filterDialogControl = LayoutHelper.FindParentObject <DialogControl>(FilterEditorFromGrid); Assert.IsNotNull(filterDialogControl); UIAutomationActions.ClickButton(filterDialogControl.CancelButton); }); }
void AddAction_ToggleCheckEdit(Func <CheckEdit> getCheckEdit, object expectedValue, Func <object> getActualValue) { Dispatch(() => { EditorsActions.ToggleCheckEdit(getCheckEdit()); }); Assert.AreEqual(expectedValue, DispatchExpr(getActualValue)); }
void CreateCheckCopyPasteDemoActions() { AddLoadModuleActions(typeof(CopyPasteOperations)); AddSimpleAction(delegate() { Assert.IsTrue(CopyPasteModule.firstGrid.ClipboardCopyMode != DevExpress.Xpf.Grid.ClipboardCopyMode.None); Assert.IsTrue(CopyPasteModule.secondGrid.ClipboardCopyMode != DevExpress.Xpf.Grid.ClipboardCopyMode.None); EditorsActions.ToggleCheckEdit(CopyPasteModule.allowCopyingtoClipboardCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsTrue(CopyPasteModule.firstGrid.ClipboardCopyMode == DevExpress.Xpf.Grid.ClipboardCopyMode.None); Assert.IsTrue(CopyPasteModule.secondGrid.ClipboardCopyMode == DevExpress.Xpf.Grid.ClipboardCopyMode.None); EditorsActions.ToggleCheckEdit(CopyPasteModule.allowCopyingtoClipboardCheckEdit); UpdateLayoutAndDoEvents(); AssertGridsAndButtonState(FocusedGrid.None, false, false, false, false); Assert.AreEqual(10, CopyPasteModule.firstGrid.VisibleRowCount); Assert.AreEqual(0, CopyPasteModule.secondGrid.VisibleRowCount); Assert.AreEqual(0, CopyPasteModule.CopyPasteDemoTabControl.SelectedIndex); ClickOnGrid(CopyPasteModule.firstGrid); CopyPasteModule.firstGrid.SelectRange(1, 4); UpdateLayoutAndDoEvents(); AssertGridsAndButtonState(FocusedGrid.First, true, true, false, true); Assert.AreEqual(0, CopyPasteModule.PasteRule.SelectedIndex); UIAutomationActions.ClickButton(CopyPasteModule.CopyButton); UpdateLayoutAndDoEvents(); ClickOnGrid(CopyPasteModule.secondGrid); UpdateLayoutAndDoEvents(); AssertGridsAndButtonState(FocusedGrid.Second, false, false, true, false); UIAutomationActions.ClickButton(CopyPasteModule.PasteButton); }); AddEventAction(CopyPasteOperations.PasteCompetedEvent, () => DemoBaseTesting.CurrentDemoModule, null, null); AddSimpleAction(delegate() { Assert.AreEqual(5, CopyPasteModule.secondGrid.VisibleRowCount); ClickOnGrid(CopyPasteModule.firstGrid); UpdateLayoutAndDoEvents(); AssertGridsAndButtonState(FocusedGrid.First, true, true, true, true); UIAutomationActions.ClickButton(CopyPasteModule.DeleteButton); UpdateLayoutAndDoEvents(); Assert.AreEqual(5, CopyPasteModule.firstGrid.VisibleRowCount); CopyPasteModule.CopyPasteDemoTabControl.SelectedIndex = 1; UpdateLayoutAndDoEvents(); CopyPasteModule.textEdit.Focus(); UpdateLayoutAndDoEvents(); AssertGridsAndButtonState(FocusedGrid.First, false, false, true, false); UIAutomationActions.ClickButton(CopyPasteModule.PasteButton); UpdateLayoutAndDoEvents(); Assert.AreEqual("Id From Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 40)); CopyPasteModule.textEdit.Select(0, 8); UpdateLayoutAndDoEvents(); CopyPasteModule.textEdit.Focus(); UpdateLayoutAndDoEvents(); AssertGridsAndButtonState(FocusedGrid.First, true, true, true, true); UIAutomationActions.ClickButton(CopyPasteModule.CutButton); UpdateLayoutAndDoEvents(); Assert.AreEqual("Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 32)); CopyPasteModule.textEdit.Focus(); UpdateLayoutAndDoEvents(); CopyPasteModule.textEdit.CaretIndex = 0; UIAutomationActions.ClickButton(CopyPasteModule.PasteButton); UpdateLayoutAndDoEvents(); Assert.AreEqual("Id From Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 40)); CopyPasteModule.textEdit.SelectAll(); UpdateLayoutAndDoEvents(); CopyPasteModule.textEdit.Focus(); UpdateLayoutAndDoEvents(); UIAutomationActions.ClickButton(CopyPasteModule.CopyButton); UpdateLayoutAndDoEvents(); CopyPasteModule.textEdit.Focus(); UpdateLayoutAndDoEvents(); UIAutomationActions.ClickButton(CopyPasteModule.DeleteButton); UpdateLayoutAndDoEvents(); Assert.AreEqual("", CopyPasteModule.textEdit.Text); CopyPasteModule.textEdit.Focus(); UpdateLayoutAndDoEvents(); UIAutomationActions.ClickButton(CopyPasteModule.PasteButton); UpdateLayoutAndDoEvents(); Assert.AreEqual("Id From Sent Hours Active Has Attachment", CopyPasteModule.textEdit.Text.Substring(0, 40)); CopyPasteModule.CopyPasteDemoTabControl.SelectedIndex = 0; UpdateLayoutAndDoEvents(); CopyPasteModule.secondGrid.UnselectAll(); CopyPasteModule.secondGrid.SelectItem(2); UpdateLayoutAndDoEvents(); ((GridDemo.CopyPasteOutlookData)((DevExpress.Xpf.Grid.GridViewBase)CopyPasteModule.secondGrid.View).Grid.SelectedItems[0]).From = "QWERTY"; ClickOnGrid(CopyPasteModule.secondGrid); UpdateLayoutAndDoEvents(); UIAutomationActions.ClickButton(CopyPasteModule.CutButton); UpdateLayoutAndDoEvents(); Assert.AreEqual(4, CopyPasteModule.secondGrid.VisibleRowCount); CopyPasteModule.firstGrid.View.FocusedRowHandle = 2; ClickOnGrid(CopyPasteModule.firstGrid); UpdateLayoutAndDoEvents(); UIAutomationActions.ClickButton(CopyPasteModule.PasteButton); }); AddEventAction(CopyPasteOperations.PasteCompetedEvent, () => DemoBaseTesting.CurrentDemoModule, null, null); AddSimpleAction(delegate() { Assert.AreEqual(6, CopyPasteModule.firstGrid.VisibleRowCount); Assert.AreEqual("QWERTY", ((GridDemo.CopyPasteOutlookData)CopyPasteModule.firstGrid.GetRow(3)).From); CopyPasteModule.PasteRule.SelectedIndex = 1; UIAutomationActions.ClickButton(CopyPasteModule.PasteButton); }); AddEventAction(CopyPasteOperations.PasteCompetedEvent, () => DemoBaseTesting.CurrentDemoModule, null, null); AddSimpleAction(delegate() { Assert.AreEqual(7, CopyPasteModule.firstGrid.VisibleRowCount); Assert.AreEqual("QWERTY", ((GridDemo.CopyPasteOutlookData)CopyPasteModule.firstGrid.GetRow(6)).From); }); }
void CreateCheckTableViewDemoActions() { AddLoadModuleActions(typeof(StandardTableView)); AddSimpleAction(delegate() { Assert.IsTrue(TableView.AutoWidth); Assert.IsTrue(TableView.AllowSorting); Assert.IsTrue(TableView.AllowGrouping); Assert.IsTrue(TableView.AllowColumnMoving); Assert.IsTrue(TableView.AllowResizing); Assert.IsTrue(TableView.AllowBestFit); Assert.IsTrue(TableView.ShowHorizontalLines); Assert.IsTrue(TableView.ShowVerticalLines); EditorsActions.ToggleCheckEdit(TableViewModule.autoWidthCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.AutoWidth); EditorsActions.ToggleCheckEdit(TableViewModule.allowSortingCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.AllowSorting); Assert.IsFalse(GridControl.Columns["OrderID"].ActualAllowSorting); Assert.IsFalse(GridControl.Columns["OrderID"].ActualAllowGrouping); EditorsActions.ToggleCheckEdit(TableViewModule.allowSortingCheckEdit); EditorsActions.ToggleCheckEdit(TableViewModule.allowGroupingCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.AllowGrouping); Assert.IsTrue(GridControl.Columns["OrderID"].ActualAllowSorting); Assert.IsFalse(GridControl.Columns["OrderID"].ActualAllowGrouping); EditorsActions.ToggleCheckEdit(TableViewModule.allowMovingCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.AllowColumnMoving); Assert.IsFalse(GridControl.Columns["OrderID"].ActualAllowMoving); EditorsActions.ToggleCheckEdit(TableViewModule.allowResizingCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.AllowResizing); Assert.IsFalse(GridControl.Columns["OrderID"].ActualAllowResizing); EditorsActions.ToggleCheckEdit(TableViewModule.allowBestFitCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.AllowBestFit); EditorsActions.ToggleCheckEdit(TableViewModule.showHorizontalLinesCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.ShowHorizontalLines); EditorsActions.ToggleCheckEdit(TableViewModule.showVerticalLinesCheckEdit); UpdateLayoutAndDoEvents(); Assert.IsFalse(TableView.ShowVerticalLines); Assert.AreEqual(DevExpress.Xpf.Grid.GridViewNavigationStyle.Row, TableViewModule.NavigationStyleComboBox.SelectedItem); Assert.AreEqual(DevExpress.Xpf.Grid.GridViewNavigationStyle.Row, View.NavigationStyle); TableViewModule.NavigationStyleComboBox.SelectedItem = DevExpress.Xpf.Grid.GridViewNavigationStyle.Cell; UpdateLayoutAndDoEvents(); Assert.AreEqual(DevExpress.Xpf.Grid.GridViewNavigationStyle.Cell, View.NavigationStyle); TableViewModule.NavigationStyleComboBox.SelectedItem = DevExpress.Xpf.Grid.GridViewNavigationStyle.None; UpdateLayoutAndDoEvents(); Assert.AreEqual(DevExpress.Xpf.Grid.GridViewNavigationStyle.None, View.NavigationStyle); }); }
void CreateCheckHitTestDemoActions() { AddLoadModuleActions(typeof(GridDemo.HitTesting)); AddSimpleAction(delegate() { Assert.IsTrue(HitTestModule.showHitInfoCheckEdit.IsChecked.Value); Assert.AreEqual(0, HitTestModule.viewsListBox.SelectedIndex); Assert.AreEqual(GridControl, HitTestModule.hitInfoPopup.PlacementTarget); Assert.AreEqual(PlacementMode.Mouse, HitTestModule.hitInfoPopup.Placement); MouseActions.MouseMove(GridControl, -5, -5); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); MouseActions.MouseMove(GridControl, 5, 5); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); Assert.AreEqual(0d, HitTestModule.hitInfoPopup.HorizontalOffset); Assert.AreEqual(0d, HitTestModule.hitInfoPopup.VerticalOffset); EditorsActions.ToggleCheckEdit(HitTestModule.showHitInfoCheckEdit); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); EditorsActions.ToggleCheckEdit(HitTestModule.showHitInfoCheckEdit); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); MouseActions.LeftMouseDown(GridControlHelper.GetColumnHeaderElements(GridControl, GridControl.Columns[0])[0], 5, 5); MouseActions.MouseMove(GridControlHelper.GetColumnHeaderElements(GridControl, GridControl.Columns[0])[0], 25, 5); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); MouseActions.LeftMouseUp(GridControlHelper.GetColumnHeaderElements(GridControl, GridControl.Columns[0])[0], 5, 5); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); TableView.ShowColumnChooser(); UpdateLayoutAndDoEvents(); Assert.IsFalse(HitTestModule.hitInfoPopup.IsOpen); TableView.HideColumnChooser(); UpdateLayoutAndDoEvents(); Assert.IsTrue(HitTestModule.hitInfoPopup.IsOpen); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("HitTest", GetHitInfoNameTextControl(0).NameValue); Assert.AreEqual("ColumnHeader", GetHitInfoNameTextControl(0).TextValue); Assert.AreEqual("Column", GetHitInfoNameTextControl(1).NameValue); Assert.AreEqual("ID", GetHitInfoNameTextControl(1).TextValue); Assert.AreEqual("RowHandle", GetHitInfoNameTextControl(2).NameValue); Assert.AreEqual("No row", GetHitInfoNameTextControl(2).TextValue); Assert.AreEqual("CellValue", GetHitInfoNameTextControl(3).NameValue); Assert.AreEqual("", GetHitInfoNameTextControl(3).TextValue); MouseActions.MouseMove(LayoutHelper.FindElementByName(GridControl, "PART_NewItemRow"), 35, 5); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("New Item Row", GetHitInfoNameTextControl(2).TextValue); MouseActions.MouseMove(LayoutHelper.FindElementByName(GridControl, "PART_FilterRow"), 35, 5); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("Auto Filter Row", GetHitInfoNameTextControl(2).TextValue); MouseActions.MouseMove(View.GetCellElementByRowHandleAndColumn(0, GridControl.Columns[0]), 35, 5); Assert.AreEqual(4, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("0 (data row)", GetHitInfoNameTextControl(2).TextValue); Assert.AreEqual("10248", GetHitInfoNameTextControl(3).TextValue); AssertAdditionalElements(); MouseActions.MouseMove(LayoutHelper.FindElement(LayoutHelper.FindElement(GridControl, IsGroupGridRow), e => e is DevExpress.Xpf.Grid.GroupRowIndicator), 5, 5); Assert.AreEqual(5, HitTestModule.hitIfoItemsControl.Items.Count); Assert.AreEqual("RowIndicatorState", GetHitInfoNameTextControl(4).NameValue); Assert.AreEqual("Focused", GetHitInfoNameTextControl(4).TextValue); HitTestModule.viewsListBox.SelectedIndex = 1; CardView.CardLayout = DevExpress.Xpf.Grid.CardLayout.Rows; UpdateLayoutAndDoEvents(); Assert.IsNotNull(CardView); AssertAdditionalElements(); }); }