Exemplo n.º 1
0
        public async Task SortTest02()
        {
            VisualTreeObject actual = null;

            using (var script = new ControlTestScript(typeof(VariableGridHost))) {
                await PrepareControl(_hostScript, script, "grid.test <- mtcars");

                UIThreadHelper.Instance.Invoke(() => {
                    var grid = VisualTreeTestExtensions.FindFirstVisualChildOfType <VisualGrid>(script.Control);

                    var header = VisualTreeTestExtensions.FindFirstVisualChildOfType <HeaderTextVisual>(script.Control); // mpg
                    header     = VisualTreeTestExtensions.FindNextVisualSiblingOfType <HeaderTextVisual>(header);        // cyl
                    header.Should().NotBeNull();

                    grid.ToggleSort(header, false);
                    DoIdle(200);

                    header = VisualTreeTestExtensions.FindNextVisualSiblingOfType <HeaderTextVisual>(header); // disp
                    header = VisualTreeTestExtensions.FindNextVisualSiblingOfType <HeaderTextVisual>(header); // hp

                    grid.ToggleSort(header, add: true);
                    grid.ToggleSort(header, add: true);
                    DoIdle(200);
                });

                actual = VisualTreeObject.Create(script.Control);
                ViewTreeDump.CompareVisualTrees(_files, actual, "VariableGridSorted02");
            }
        }
Exemplo n.º 2
0
 private Task <bool> WaitForControlReady(ControlTestScript script)
 => Task.Run(async() => {
     var startTime           = DateTime.Now;
     HeaderTextVisual header = null;
     while (header == null && (DateTime.Now - startTime).TotalMilliseconds < 5000)
     {
         DoIdle(200);
         header = await VisualTreeTestExtensions.FindFirstVisualChildOfType <HeaderTextVisual>(script.Control);
     }
     return(header != null);
 });
Exemplo n.º 3
0
        public async Task SortTest01()
        {
            using (var script = new ControlTestScript(typeof(VariableGridHost), Services)) {
                await PrepareControl(_hostScript, script, "grid.test <- matrix(1:10, 2, 5)");

                var header = VisualTreeTestExtensions.FindFirstVisualChildOfType <HeaderTextVisual>(script.Control);
                var grid   = VisualTreeTestExtensions.FindFirstVisualChildOfType <VisualGrid>(script.Control);
                header.Should().NotBeNull();
                await UIThreadHelper.Instance.InvokeAsync(() => {
                    grid.ToggleSort(header, false);
                    DoIdle(200);
                    grid.ToggleSort(header, false);
                });

                DoIdle(200);
                var actual = VisualTreeObject.Create(script.Control);
                ViewTreeDump.CompareVisualTrees(_files, actual, "VariableGridSorted01");
            }
        }