Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/WPF/CS/BarsDemo.Wpf/DemoTesting/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/WPF/CS/BarsDemo.Wpf/DemoTesting/Fixtures.cs

using DevExpress.Xpf.DemoBase.DemoTesting;
using System;
using DevExpress.Xpf.Bars;
using System.Reflection;
using DevExpress.Xpf.Core.Native;
using System.Windows;
using System.Windows.Controls;
using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Core;
using System.Threading;
namespace BarsDemo.Tests {
    public class BarsCheckAllDemosFixture : CheckAllDemosFixture {
        Type[] skipMemoryLeaksCheckModules = new Type[] {
        };
        protected override bool CheckMemoryLeaks(Type moduleType) {
            return !EnumeratorHelper.Exists<Type>(skipMemoryLeaksCheckModules, moduleType);
        }
    }
    public class BarsDemoModulesAccessor : DemoModulesAccessor<BarsDemoModule> {
        public BarsDemoModulesAccessor(BaseDemoTestingFixture fixture)
            : base(fixture) {
        }
        public BarManager Manager { get { return DemoModule.Manager; } }
    }
    public abstract class BaseBarsDemoTestingFixture : BaseDemoTestingFixture {
        readonly BarsDemoModulesAccessor modulesAccessor;
        public BaseBarsDemoTestingFixture() {
            modulesAccessor = new BarsDemoModulesAccessor(this);
        }
        public BarManager Manager { get { return modulesAccessor.Manager; } }
    }
    public class CheckDemoOptionsFixture : BaseBarsDemoTestingFixture {
        protected override void CreateActions() {
            base.CreateActions();
            AddSimpleAction(CreateCheckDemosActions);
        }

        private void CreateCheckDemosActions() {
            CreateCheckBarPropertiesActions();
            CreateCheckItemPropertiesActions();
        }
        public BarProperties BarProperties { get { return DemoBaseTesting.CurrentDemoModule as BarProperties; } }
        public ItemProperties ItemProperties { get { return DemoBaseTesting.CurrentDemoModule as ItemProperties; } }
        BarControl GetBarControl(Bar bar) {
            VisualTreeEnumerator en = new VisualTreeEnumerator(Manager);
            while(en.MoveNext()) {
                BarControl control = en.Current as BarControl;
                if(control != null && control.Bar == bar)
                    return control;
            }
            return null;
        }
        private void CreateCheckItemPropertiesActions() {
            AddLoadModuleActions(typeof(ItemProperties));
            AddSimpleAction(CheckStartupOptions);
            AddSimpleAction(CheckBarButtonItemProperties);
            AddSimpleAction(CheckBarCheckItemProperties);
            AddSimpleAction(CheckBarSplitButtonItemProperties);
            AddSimpleAction(CheckBarSubItemProperties);
        }
        private void CheckBaseItemOptions(BarItemLink link) {
            CheckBaseVisibleItemOptions(link);
            CheckBaseEnabledItemOptions(link);
            CheckBaseItemDisplayMode(link);
            CheckBaseCaptionAndGlyphAlignment(link);
            CheckBaseItemGlyphSize(link);
        }
        private void CheckBaseCaptionAndGlyphAlignment(BarItemLink link) {
            ItemProperties.captionGlyphAlignment.SelectedIndex = 0;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.ActualGlyphAlignment == Dock.Left, "link.LinkControl.ActualGlyphAlignment == Dock.Left");
            ItemProperties.captionGlyphAlignment.SelectedIndex = 1;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.ActualGlyphAlignment == Dock.Top, "link.LinkControl.ActualGlyphAlignment == Dock.Top");
            ItemProperties.captionGlyphAlignment.SelectedIndex = 2;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.ActualGlyphAlignment == Dock.Right, "link.LinkControl.ActualGlyphAlignment == Dock.Right");
            ItemProperties.captionGlyphAlignment.SelectedIndex = 3;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.ActualGlyphAlignment == Dock.Bottom, "link.LinkControl.ActualGlyphAlignment == Dock.Bottom");
        }
        private void CheckBaseItemGlyphSize(BarItemLink link) {
            Assert.IsTrue(ItemProperties.barManager.Bars[0].GlyphSize == GlyphSize.Small, "ItemProperties.barManager1.Bars[0].GlyphSize == GlyphSize.Small");
            ItemProperties.glyphSize.SelectedIndex = 0;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.IsLargeGlyph == false, "link.LinkControl.IsLargeGlyph == false");
            ItemProperties.glyphSize.SelectedIndex = 1;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.IsLargeGlyph == false, "link.LinkControl.IsLargeGlyph == false");
            ItemProperties.glyphSize.SelectedIndex = 2;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.IsLargeGlyph == true, "link.LinkControl.IsLargeGlyph == true");
        }
        private void CheckBaseItemDisplayMode(BarItemLink link) {
            ItemProperties.displayMode.SelectedIndex = 0;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.ActualShowContent == false, "link.LinkControl.ActualShowContent == false");
            Assert.IsTrue(link.LinkControl.ActualShowGlyph == true, "link.LinkControl.ActualShowGlyph == true");
            Assert.IsTrue(ItemProperties.captionGlyphAlignment.IsEnabled == false, "ItemProperties.captionGlyphAlignment.IsEnabled == false");
            ItemProperties.displayMode.SelectedIndex = 1;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.ActualShowContent == true, "link.LinkControl.ActualShowContent == true");
            Assert.IsTrue(link.LinkControl.ActualShowGlyph == false, "link.LinkControl.ActualShowGlyph == false");
            Assert.IsTrue(ItemProperties.captionGlyphAlignment.IsEnabled == false, "ItemProperties.captionGlyphAlignment.IsEnabled == false");
            ItemProperties.displayMode.SelectedIndex = 2;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.LinkControl.ActualShowContent == true, "link.LinkControl.ActualShowContent == true");
            Assert.IsTrue(link.LinkControl.ActualShowGlyph == true, "link.LinkControl.ActualShowGlyph == true");
            Assert.IsTrue(ItemProperties.captionGlyphAlignment.IsEnabled == true, "ItemProperties.captionGlyphAlignment.IsEnabled == true");
        }
        private void CheckBaseEnabledItemOptions(BarItemLink link) {
            Assert.IsTrue(ItemProperties.isEnabledCheck.IsChecked.Value == true, "ItemProperties.isEnabledCheck.IsChecked == true");
            Assert.IsTrue(link.IsEnabled == ItemProperties.isEnabledCheck.IsChecked.Value, "link.IsEnabled == ItemProperties.isEnabledCheck.IsChecked");
            ItemProperties.isEnabledCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.IsEnabled == ItemProperties.isEnabledCheck.IsChecked.Value, "link.IsEnabled == ItemProperties.isEnabledCheck.IsChecked");
            ItemProperties.isEnabledCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.IsEnabled == ItemProperties.isEnabledCheck.IsChecked.Value, "link.IsEnabled == ItemProperties.isEnabledCheck.IsChecked");
        }
        private void CheckBaseVisibleItemOptions(BarItemLink link) {
            Assert.IsTrue(ItemProperties.isVisibleCheck.IsChecked.Value == true, "ItemProperties.isVisibleCheck.IsChecked == true");
            Assert.IsTrue(link.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "link.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.baseProps.IsEnabled == true, "ItemProperties.baseProps.IsEnabled == true");
            ItemProperties.isVisibleCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "link.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.baseProps.IsEnabled == false, "ItemProperties.baseProps.IsEnabled == false");
            ItemProperties.isVisibleCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(link.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "link.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.baseProps.IsEnabled == true, "ItemProperties.baseProps.IsEnabled == true");
        }
        private void CheckStartupOptions() {
            Assert.IsTrue(ItemProperties.ButtonItem == ItemProperties.barManager.Bars[0].ItemLinks[0], "ItemProperties.ButtonItem == ItemProperties.barManager1.Bars[0].ItemLinks[0]");
            Assert.IsTrue(ItemProperties.CheckItem == ItemProperties.barManager.Bars[0].ItemLinks[1], "ItemProperties.CheckItem == ItemProperties.barManager1.Bars[0].ItemLinks[1]");
            Assert.IsTrue(ItemProperties.StaticItem == ItemProperties.barManager.Bars[1].ItemLinks[0], "ItemProperties.StaticItem == ItemProperties.barManager1.Bars[1].ItemLinks[0]");
            Assert.IsTrue(ItemProperties.SplitButtonItem == ItemProperties.barManager.Bars[0].ItemLinks[2], "ItemProperties.SplitButtonItem == ItemProperties.barManager1.Bars[0].ItemLinks[2]");
            Assert.IsTrue(ItemProperties.SubItem == ItemProperties.barManager.Bars[0].ItemLinks[3], "ItemProperties.SubItem == ItemProperties.barManager1.Bars[0].ItemLinks[3]");
            Assert.IsTrue(ItemProperties.SelectedItem == ItemProperties.ButtonItem, "ItemProperties.SelectedItem == ItemProperties.ButtonItem");

            Assert.IsTrue(((BarItemInfoControl)ItemProperties.newRadioButton.Content).Link == ItemProperties.ButtonItem, "((BarItemInfoControl)ItemProperties.newRadioButton.Content).Link == ItemProperties.ButtonItem");
            Assert.IsTrue(((BarItemInfoControl)ItemProperties.bulletsRadioButton.Content).Link == ItemProperties.CheckItem, "((BarItemInfoControl)ItemProperties.bulletsRadioButton.Content).Link == ItemProperties.CheckItem");
            Assert.IsTrue(((BarItemInfoControl)ItemProperties.fontColorRadioButton.Content).Link == ItemProperties.SplitButtonItem, "((BarItemInfoControl)ItemProperties.fontColorRadioButton.Content).Link == ItemProperties.SplitButtonItem");
            Assert.IsTrue(((BarItemInfoControl)ItemProperties.saveMenuRadioButton.Content).Link == ItemProperties.SubItem, "((BarItemInfoControl)ItemProperties.saveMenuRadioButton.Content).Link == ItemProperties.SubItem");
            Assert.IsTrue(((BarItemInfoControl)ItemProperties.infoRadioButton.Content).Link == ItemProperties.StaticItem, "((BarItemInfoControl)ItemProperties.infoRadioButton.Content).Link == ItemProperties.StaticItem");
            Assert.IsTrue(ItemProperties.newRadioButton.IsChecked.Value == true, "ItemProperties.newRadioButton.IsChecked.Value == true");
        }
        private void CheckBarButtonItemProperties() {
            CheckBaseItemOptions(ItemProperties.ButtonItem);
        }
        private void CheckBarCheckItemProperties() {
            ItemProperties.SelectedItem = ItemProperties.CheckItem;
            UpdateLayoutAndDoEvents();
            CheckBaseItemOptions(ItemProperties.CheckItem);
        }
        private void CheckBarSubItemProperties() {
            ItemProperties.SelectedItem = ItemProperties.SubItem;
            UpdateLayoutAndDoEvents();
            CheckBaseItemOptions(ItemProperties.SubItem);
            CheckBarSubItemVisibleOptions();
        }
        private void CheckBarSubItemVisibleOptions() {
            Assert.IsTrue(ItemProperties.isVisibleCheck.IsChecked.Value == true, "ItemProperties.isVisibleCheck.IsChecked == true");
            Assert.IsTrue(ItemProperties.SubItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "ItemProperties.SubItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.subProps.IsEnabled == true, "ItemProperties.subProps.IsEnabled == true");
            ItemProperties.isVisibleCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(ItemProperties.SubItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "ItemProperties.SubItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.subProps.IsEnabled == false, "ItemProperties.subProps.IsEnabled == false");
            ItemProperties.isVisibleCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(ItemProperties.SubItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "ItemProperties.SubItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.subProps.IsEnabled == true, "ItemProperties.subProps.IsEnabled == true");
        }
        private void CheckBarSplitButtonItemProperties() {
            ItemProperties.SelectedItem = ItemProperties.SplitButtonItem;
            UpdateLayoutAndDoEvents();
            CheckBaseItemOptions(ItemProperties.SplitButtonItem);
            ToggleActAsDropDown();
            ToggleArrowAlignment();
            CheckBarSplitButtonItemVisibleItemOptions();
        }
        private void CheckBarSplitButtonItemVisibleItemOptions() {
            Assert.IsTrue(ItemProperties.isVisibleCheck.IsChecked.Value == true, "ItemProperties.isVisibleCheck.IsChecked == true");
            Assert.IsTrue(ItemProperties.SplitButtonItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "ItemProperties.SplitButtonItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.splitProps.IsEnabled == true, "ItemProperties.splitProps.IsEnabled == true");
            ItemProperties.isVisibleCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(ItemProperties.SplitButtonItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "ItemProperties.SplitButtonItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.splitProps.IsEnabled == false, "ItemProperties.splitProps.IsEnabled == false");
            ItemProperties.isVisibleCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(ItemProperties.SplitButtonItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked.Value, "ItemProperties.SplitButtonItem.ActualIsVisible == ItemProperties.isVisibleCheck.IsChecked");
            Assert.IsTrue(ItemProperties.splitProps.IsEnabled == true, "ItemProperties.splitProps.IsEnabled == true");
        }
        private void ToggleArrowAlignment() {
            ItemProperties.arrowAlignment.SelectedIndex = 0;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(((BarSplitButtonItem)ItemProperties.SplitButtonItem.Item).ArrowAlignment == Dock.Right, "((BarSplitButtonItem)ItemProperties.SplitButtonItem.Item).ArrowAlignment == Dock.Right");
            ItemProperties.arrowAlignment.SelectedIndex = 1;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(((BarSplitButtonItem)ItemProperties.SplitButtonItem.Item).ArrowAlignment == Dock.Bottom, "((BarSplitButtonItem)ItemProperties.SplitButtonItem.Item).ArrowAlignment == Dock.Bottom");
        }
        private void ToggleActAsDropDown() {
            ItemProperties.actAsDropDownCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(((BarSplitButtonItem)ItemProperties.SplitButtonItem.Item).ActAsDropDown == true, "ItemProperties.SplitButtonItem.ActAsDropDown == true");
            Assert.IsTrue(ItemProperties.arrowAlignment.IsEnabled == false, "ItemProperties.arrowAlignment.IsEnabled == false");
            ItemProperties.actAsDropDownCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(((BarSplitButtonItem)ItemProperties.SplitButtonItem.Item).ActAsDropDown == false, "ItemProperties.SplitButtonItem.ActAsDropDown == false");
            Assert.IsTrue(ItemProperties.arrowAlignment.IsEnabled == true, "ItemProperties.arrowAlignment.IsEnabled == true");
        }
        private void CreateCheckBarPropertiesActions() {
            AddLoadModuleActions(typeof(BarProperties));
            AddSimpleAction(CheckBarPropertiesStartup);
            AddSimpleAction(ToggleVisible);
            AddSimpleAction(ToggleEnabled);
            AddSimpleAction(ToggleBarType);
            AddSimpleAction(ToggleContainerName);
            AddSimpleAction(ToggleUseWholeRow);
            AddSimpleAction(ToggleShowDragWidget);
            AddSimpleAction(ToggleShowCustomizationButton);
            AddSimpleAction(ToggleAllowCollapseAndIsCollapsed);
        }
        private void ToggleAllowCollapseAndIsCollapsed() {
            Bar bar1 = BarProperties.bar1;
            BarControl bc = GetBarControl(BarProperties.bar1);
            BarProperties.useWholeRowCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            BarProperties.allowCollapseCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.AllowCollapse == true, "bar1.AllowCollapse == true");
            BarProperties.isCollapsedCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.IsCollapsed == true, "bar1.IsCollapsed == true");
            BarProperties.isCollapsedCheck.IsChecked = false;
            BarProperties.allowCollapseCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
        }
        private void ToggleShowCustomizationButton() {
            Bar bar1 = BarProperties.bar1;
            BarControl bc = GetBarControl(BarProperties.bar1);
            BarProperties.showCustomizationButtonCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.IsAllowQuickCustomization == false, "bar1.AllowQuickCustomization == false");
            BarProperties.showCustomizationButtonCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
        }
        private void ToggleShowDragWidget() {
            Bar bar1 = BarProperties.bar1;
            BarControl bc = GetBarControl(BarProperties.bar1);
            BarProperties.showDragWidgetCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.ShowDragWidget == false, "bar1.ShowDragWidget == false");
            BarProperties.showDragWidgetCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
        }
        private void ToggleUseWholeRow() {
        }
        private void ToggleContainerName() {
            Bar bar1 = BarProperties.bar1;
            BarControl bc = GetBarControl(BarProperties.bar1);
            BarProperties.containerName.SelectedIndex = 1;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.DockInfo.Container.Name == "Bottom_Container", "bar1.DockInfo.Container.Name == Bottom_Container");
            BarProperties.containerName.SelectedIndex = 2;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.DockInfo.Container.Name == "Left_Container", "bar1.DockInfo.Container.Name == Left_Container");
            BarProperties.containerName.SelectedIndex = 3;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.DockInfo.Container.Name == "Right_Container", "bar1.DockInfo.Container.Name == Right_Container");
            BarProperties.containerName.SelectedIndex = 0;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.DockInfo.Container.Name == "Top_Container", "bar1.DockInfo.Container.Name == Top_Container");
        }
        private void ToggleEnabled() {
            Bar bar1 = BarProperties.bar1;
            BarControl bc = GetBarControl(BarProperties.bar1);
            BarProperties.isEnabledCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bc.IsEnabled == false, "bc.IsEnabled == false");
            BarProperties.isEnabledCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bc.IsEnabled == true, "bc.IsEnabled == true");
        }
        private void ToggleVisible() {
            Bar bar1 = BarProperties.bar1;
            BarControl bc = GetBarControl(BarProperties.bar1);
            BarProperties.isVisibleCheck.IsChecked = false;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bc.Visibility == Visibility.Collapsed, "bc.Visibility == Visibility.Collapsed");
            Assert.IsTrue(BarProperties.props.IsEnabled == false, "BarProperties.props.IsEnabled == false");
            BarProperties.isVisibleCheck.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bc.Visibility == Visibility.Visible, "bc.Visibility == Visibility.Visible");
            Assert.IsTrue(BarProperties.props.IsEnabled == true, "BarProperties.props.IsEnabled == true");
        }
        private void ToggleBarType() {
            Bar bar1 = BarProperties.bar1;
            BarControl bc = GetBarControl(BarProperties.bar1);
            BarProperties.barTypeMainMenu.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.IsMainMenu == true, "bar1.IsMainMenu == true");
            BarProperties.barTypeStatusBar.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.IsStatusBar == true, "bar1.IsStatusBar == true");
            Assert.IsTrue(bar1.DockInfo.ContainerName == "Bottom_Container", "bar1.DockInfo.ContainerName == Bottom_Container");
            BarProperties.barTypeBar.IsChecked = true;
            UpdateLayoutAndDoEvents();
            Assert.IsTrue(bar1.IsStatusBar == false, "bar1.IsStatusBar == false");
            Assert.IsTrue(bar1.IsMainMenu == false, "bar1.IsMainMenu == false");
            Assert.IsTrue(bar1.DockInfo.ContainerName == "Top_Container", "bar1.DockInfo.ContainerName == Top_Container");
        }
        private void CheckBarPropertiesStartup() {
            Bar bar = BarProperties.bar1;
            Assert.IsTrue(BarProperties.Bar == bar, "Bar Property initialization failed");
            Assert.IsTrue(BarProperties.barTypeBar.IsChecked.Value == true, "BarType selected index");
            Assert.IsTrue(BarProperties.isVisibleCheck.IsChecked.Value == true, "BarProperties.isVisibleCheck should be true");
            Assert.IsTrue(BarProperties.isEnabledCheck.IsChecked.Value == true, "BarProperties.isEnabledCheck should be true");
            Assert.IsTrue(bar.IsEnabled == true, "BarProperties.bar1.IsEnabled should be true");
            Assert.IsTrue(bar.Visible == true, "BarProperties.bar1.Visible should be true");
            Assert.IsTrue(BarProperties.allowCollapseCheck.IsChecked.Value == false, "BarProperties.allowCollapseCheck.IsChecked should be false");
            Assert.IsTrue(BarProperties.isCollapsedCheck.IsChecked.Value == false, "BarProperties.isCollapsedCheck.IsChecked should be false");
            Assert.IsTrue(BarProperties.useWholeRowCheck.IsChecked.Value == true, "arProperties.useWholeRowCheck.IsChecked should be true");
            String str = (string)BarProperties.containerName.EditValue;
            Assert.IsTrue(str.Equals("Top_Container"), "BarProperties.containerName.EditValue should Top_Container");
            BarControl bc = GetBarControl(BarProperties.bar1);
            Assert.IsTrue(bc.Visibility == System.Windows.Visibility.Visible, "BarControl should be visible");
            Assert.IsTrue(bc.IsEnabled, "BarControl should be enabled");
            Assert.IsTrue(bc.MaxGlyphSize == new Size(32, 32), "BarControl.MaxGlyphSize should be 32,32");
            Assert.IsTrue(bc.Bar.ShowDragWidget == true, "BarProperties.bar1.ShowDragWidget should be true");
            Assert.IsTrue(bc.Bar.IsAllowQuickCustomization == true, "BarProperties.bar1.AllowQuickCustomization should be true");
            Assert.IsTrue(bc.Bar.IsUseWholeRow == true, "BarProperties.bar1.UseWholeRow should be true");
            Assert.IsTrue(bc.Bar.AllowCollapse == false, "BarProperties.bar1.AllowCollapse should be false");
            Assert.IsTrue(bc.Bar.IsCollapsed == false, "BarProperties.bar1.IsCollapsed should be false");
            Assert.IsTrue(bar.DockInfo.Container.Name == "Top_Container", "bar1.DockInfo.Container.Name should Top_Container");
        }
    }
    public class BugFixesFixture : BaseBarsDemoTestingFixture {
        protected override void CreateActions() {
            base.CreateActions();
            CreateSimplePadDemoActions();
        }
        #region SimplePadDemo
        void CreateSimplePadDemoActions() {
            AddSimpleAction(SimplePadDemo_B185791);
            AddSimpleAction(SimplePadDemo_B185808_B186210);
        }
        void WaitFor(TimeSpan timeSpan, UIElement element) {
            DateTime targetDateTime = DateTime.Now + timeSpan;
            while(DateTime.Now <= targetDateTime)
                if(element != null)
                    DispatcherHelper.UpdateLayoutAndDoEvents(element);
                else
                    DispatcherHelper.DoEvents();
        }
        void SimplePadDemo_B185791() {
            AddLoadModuleActions(typeof(SimplePad));
            AddSimpleAction(delegate() {
                BarSubItem menuItem = Manager.Items["bsFormat"] as BarSubItem;
                Assert.IsNotNull(menuItem);
                BarSubItemLink menuLink = Manager.MainMenu.ItemLinks.Find((link) => ((BarItemLink)link).Item.Equals(menuItem)) as BarSubItemLink;
                Assert.IsNotNull(menuLink);
                BarSubItemLinkControl menuLinkControl = menuLink.LinkControl as BarSubItemLinkControl;
                Assert.IsNotNull(menuLinkControl);

                MouseActions.MouseMove(menuLinkControl, 10, 10);
                WaitFor(new TimeSpan(0,0,0,0,100), Manager);
                MouseActions.LeftMouseDown(menuLinkControl, 10, 10);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                MouseActions.LeftMouseUp(menuLinkControl, 10, 10);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                Assert.IsTrue(menuLinkControl.IsPopupOpen);

                BarEditItem editItem = Manager.Items["eFontFamily"] as BarEditItem;
                Assert.IsNotNull(editItem);
                BarEditItemLink editLink = menuItem.ItemLinks.Find((link) => ((BarItemLink)link).Item.Equals(editItem)) as BarEditItemLink;
                Assert.IsNotNull(editLink);
                BarEditItemLinkControl editLinkControl = editLink.LinkControl as BarEditItemLinkControl;
                Assert.IsNotNull(editLinkControl);

                BarSplitButtonItem splitItem = Manager.Items["bFontColor"] as BarSplitButtonItem;
                Assert.IsNotNull(splitItem);
                BarSplitButtonItemLink splitLink = menuItem.ItemLinks.Find((link) => ((BarItemLink)link).Item.Equals(splitItem)) as BarSplitButtonItemLink;
                Assert.IsNotNull(splitLink);
                BarSplitButtonItemLinkControl splitLinkControl = splitLink.LinkControl as BarSplitButtonItemLinkControl;
                Assert.IsNotNull(splitLinkControl);

                SubMenuBarControl menuPopupControl =
                    LayoutHelper.FindParentObject<SubMenuBarControl>(splitLinkControl);
                Assert.IsNotNull(menuPopupControl);

                ArrowControl splitArrowControl =
                    LayoutHelper.FindElement(splitLinkControl, (element) => (element is ArrowControl)) as ArrowControl;
                Assert.IsNotNull(splitArrowControl);

                ComboBoxEdit editor =
                    LayoutHelper.FindElement(editLinkControl, (element) => (element is ComboBoxEdit)) as ComboBoxEdit;
                Assert.IsNotNull(editor);

                Point pt1 = splitArrowControl.TranslatePoint(new Point(2, 2), menuPopupControl);
                Point pt2 = menuPopupControl.TranslatePoint(pt1, Manager);

                MouseActions.MouseMove(Manager, pt2.X, pt2.Y);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                MouseActions.LeftMouseDown(Manager, pt2.X, pt2.Y);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                MouseActions.LeftMouseUp(Manager, pt2.X, pt2.Y);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                Assert.IsTrue(menuLinkControl.IsPopupOpen);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                Assert.IsTrue(splitLinkControl.IsPopupOpen);

                Point pt3 = editor.TranslatePoint(new Point(editor.ActualWidth - 5, 5), menuPopupControl);
                Point pt4 = menuPopupControl.TranslatePoint(pt3, Manager);
                MouseActions.LeftMouseDown(Manager, pt4.X, pt4.Y);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                MouseActions.LeftMouseUp(Manager, pt4.X, pt4.Y);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                Assert.IsTrue(menuLinkControl.IsPopupOpen);
                Assert.IsTrue(editor.IsPopupOpen);
                Assert.IsFalse(splitLinkControl.IsPopupOpen);

                MouseActions.LeftMouseDown((FrameworkElement)Manager.Child, 15, 15);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                MouseActions.LeftMouseUp((FrameworkElement)Manager.Child, 15, 15);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                Assert.IsTrue(menuLinkControl.IsPopupOpen);
                Assert.IsFalse(editor.IsPopupOpen);
                Assert.IsFalse(splitLinkControl.IsPopupOpen);

                MouseActions.LeftMouseDown(menuLinkControl, menuLinkControl.ActualWidth + 15, 15);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                MouseActions.LeftMouseUp(menuLinkControl, menuLinkControl.ActualWidth + 15, 15);
                WaitFor(new TimeSpan(0, 0, 0, 0, 100), Manager);
                Assert.IsFalse(menuLinkControl.IsPopupOpen);
                Assert.IsFalse(editor.IsPopupOpen);
                Assert.IsFalse(splitLinkControl.IsPopupOpen);
            });
        }
        void SimplePadDemo_B185808_B186210() {
            AddLoadModuleActions(typeof(SimplePad));
            AddSimpleAction(delegate() {
                Bar bar = Manager.Bars.GetBarByCaption("Format");
                Assert.IsNotNull(bar);
                BarControl barControl = LayoutHelper.FindElement(Manager, (element) => (element is BarControl) && ((BarControl)element).Bar.Equals(bar)) as BarControl;
                Assert.IsNotNull(barControl);

                DragWidget dragWidget = LayoutHelper.FindElement(barControl, (element) => (element is DragWidget)) as DragWidget;
                Assert.IsNotNull(dragWidget);

                Point pt1 = dragWidget.TranslatePoint(new Point(5, 5), Manager);
                Point pt2 = dragWidget.TranslatePoint(new Point(5, 100), Manager);

                MouseActions.LeftMouseDown(Manager, pt1.X, pt1.Y);
                MouseActions.MouseMove(Manager, pt2.X, pt2.Y);
                MouseActions.LeftMouseUp(Manager, pt2.X, pt2.Y);
                Assert.IsTrue(bar.DockInfo.Container.IsFloating);

                BarSplitButtonItem menu = Manager.Items["bFontColor"] as BarSplitButtonItem;
                Assert.IsNotNull(menu);
                BarSplitButtonItemLink menuLink = bar.ItemLinks.Find((link) => (link is BarItemLink) && ((BarItemLink)link).Item != null && ((BarItemLink)link).Item.Equals(menu)) as BarSplitButtonItemLink;
                Assert.IsNotNull(menuLink);
                BarSplitButtonItemLinkControl menuLinkControl = menuLink.LinkControl as BarSplitButtonItemLinkControl;
                Assert.IsNotNull(menuLinkControl);
                menuLinkControl.ShowPopup();
                DispatcherHelper.DoEvents();
                Assert.IsTrue(menuLinkControl.IsPopupOpen);
                MouseActions.LeftMouseDown(Manager, pt2.X + 40, pt2.Y + 15);
                MouseActions.LeftMouseUp(Manager, pt2.X + 20, pt2.Y + 10);
                Assert.IsFalse(menuLinkControl.IsPopupOpen);
                menuLinkControl.ShowPopup();
                DispatcherHelper.DoEvents();
                Assert.IsTrue(menuLinkControl.IsPopupOpen);
                MouseActions.LeftMouseDown(Manager, pt2.X + 40, pt2.Y + 15);
                MouseActions.MouseMove(Manager, pt1.X, pt1.Y);
                MouseActions.LeftMouseUp(Manager, pt1.X, pt1.Y);
                Assert.IsFalse(menuLinkControl.IsPopupOpen);
                Assert.IsFalse(bar.DockInfo.Container.IsFloating);

                menuLinkControl = menuLink.LinkControl as BarSplitButtonItemLinkControl;
                Assert.IsNotNull(menuLinkControl);

                menuLinkControl.ShowPopup();
                DispatcherHelper.DoEvents();
                Assert.IsTrue(menuLinkControl.IsPopupOpen);

                BarControl barControl1 = LayoutHelper.FindElement(Manager, (element) => (element is BarControl) && ((BarControl)element).Bar.Equals(bar)) as BarControl;
                Assert.IsNotNull(barControl1);

                DragWidget dragWidget1 = LayoutHelper.FindElement(barControl1, (element) => (element is DragWidget)) as DragWidget;
                Assert.IsNotNull(dragWidget1);

                pt1 = dragWidget1.TranslatePoint(new Point(5, 5), Manager);
                pt2 = dragWidget1.TranslatePoint(new Point(5, 100), Manager);

                MouseActions.LeftMouseDown(Manager, pt1.X, pt1.Y);
                MouseActions.MouseMove(Manager, pt2.X, pt2.Y);
                MouseActions.LeftMouseUp(Manager, pt2.X, pt2.Y);
                Assert.IsFalse(menuLinkControl.IsPopupOpen);
                Assert.IsTrue(bar.DockInfo.Container.IsFloating);

                menuLinkControl = menuLink.LinkControl as BarSplitButtonItemLinkControl;
                Assert.IsNotNull(menuLinkControl);

                menuLinkControl.ShowPopup();
                DispatcherHelper.DoEvents();
                Assert.IsTrue(menuLinkControl.IsPopupOpen);
                menuLinkControl.ClosePopup();
                Assert.IsFalse(menuLinkControl.IsPopupOpen);
            });
        }
        #endregion
    }
}