示例#1
0
        public async Task SortTest02()
        {
            VisualTreeObject actual = null;

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

                    await UIThreadHelper.Instance.InvokeAsync(async() => {
                        var grid = await VisualTreeExtensions.FindChildAsync <VisualGrid>(script.Control);

                        var header = await VisualTreeExtensions.FindChildAsync <HeaderTextVisual>(script.Control); // mpg
                        header     = await VisualTreeExtensions.FindNextSiblingAsync <HeaderTextVisual>(header);   // cyl
                        header.Should().NotBeNull();

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

                        header = await VisualTreeExtensions.FindNextSiblingAsync <HeaderTextVisual>(header); // disp
                        header = await VisualTreeExtensions.FindNextSiblingAsync <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");
                }
            }
        }