示例#1
0
        public void PackageManagerCrashTestOnDownloadingInvalidPackage()
        {
            string packageDirectory = Path.Combine(GetTestDirectory(ExecutingDirectory), @"pkgs\Autodesk Steel Package");

            try
            {
                LoadPackage(packageDirectory);
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to load the package: " + e);
            }

            var loader       = GetPackageLoader();
            var packageFound = loader.LocalPackages.Any(x => x.Name == "Autodesk Steel Connections 2020");

            Assert.IsFalse(packageFound);

            var preferencesWindow = new PreferencesView(View)
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            preferencesWindow.Show();

            AssertWindowOwnedByDynamoView <PreferencesView>();
        }
示例#2
0
        void TrayIconOnOpenPreferences()
        {
            var preferencesViewModel = new PreferencesViewModel(settingsProvider, new ScreenManager());
            var preferencesView      = new PreferencesView(preferencesViewModel);

            preferencesView.Show();
        }
示例#3
0
        public void PreferencesGeoScaling_RunGraph_Manual_Mode()
        {
            //The GeometryScalingCodeBlock.dyn contains a CodeBlock with a large number that needs ScaleFactor > Medium
            Open(@"core\GeometryScalingCodeBlock.dyn");

            //Creates the Preferences dialog and the ScaleFactor = 2 ( Medium)
            var preferencesWindow = new PreferencesView(View);

            preferencesWindow.Show();
            DispatcherUtil.DoEvents();

            //Change the RadioButton checked so the ScaleFactor is updated to -2 (Small)
            preferencesWindow.RadioSmall.IsChecked = true;
            DispatcherUtil.DoEvents();

            //Close the Preferences Dialog and due that the ScaleFactor was updated the MarkNodesAsModifiedAndRequestRun() method will be called
            preferencesWindow.CloseButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            DispatcherUtil.DoEvents();

            //This will get the Circle.ByCenterPointRadius node (connected to the CodeBlock)
            var nodeView = NodeViewWithGuid("bcf1c893-5311-4dff-9a04-203ffb9d426c");

            //When RunType = Manual and the MarkNodesAsModifiedAndRequestRun() method is called, the graph won't be executed and the node state will remain in Active
            Assert.AreEqual(nodeView.ViewModel.State, ElementState.Active);
        }
示例#4
0
        public void PreferencesGeoScaling_RunGraph_Automatic()
        {
            //The GeometryScalingCodeBlock.dyn contains a CodeBlock with a large number that needs ScaleFactor > Medium
            Open(@"core\GeometryScalingCodeBlock.dyn");

            //Change the RunType to Automatic, so when the MarkNodesAsModifiedAndRequestRun() is called a graph execution will be kicked off
            View.RunSettingsControl.RunTypesComboBox.SelectedItem = View.RunSettingsControl.RunTypesComboBox.Items[1];
            DispatcherUtil.DoEvents();

            //This will get the Circle.ByCenterPointRadius node (connected to the CodeBlock)
            var nodeView = NodeViewWithGuid("bcf1c893-5311-4dff-9a04-203ffb9d426c");

            //Checking that the node is not in a warning state before changing the scale factor
            Assert.AreEqual(nodeView.ViewModel.State, ElementState.Active);

            //Creates the Preferences dialog and the ScaleFactor = 2 ( Medium)
            var preferencesWindow = new PreferencesView(View);

            preferencesWindow.Show();
            DispatcherUtil.DoEvents();

            //Change the RadioButton checked so the ScaleFactor is updated to -2 (Small)
            preferencesWindow.RadioSmall.IsChecked = true;
            DispatcherUtil.DoEvents();

            //Close the Preferences Dialog and due that the ScaleFactor was updated the MarkNodesAsModifiedAndRequestRun() method will be called
            preferencesWindow.CloseButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            DispatcherUtil.DoEvents();

            //When RunType = Automatic when the graph is executed the ByCenterPointRadius node change status to Warning due that ScaleFactor = Small
            Assert.AreEqual(nodeView.ViewModel.State, ElementState.Warning);
        }
示例#5
0
        public void CanOpenManagePackagesDialogAndWindowIsOwned()
        {
            var preferencesWindow = new PreferencesView(View)
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            preferencesWindow.Show();

            AssertWindowOwnedByDynamoView <PreferencesView>();
        }
示例#6
0
        public void ManagePackagesDialogClosesWithDynamo()
        {
            var preferencesWindow = new PreferencesView(View)
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            preferencesWindow.Show();

            AssertWindowOwnedByDynamoView <PreferencesView>();
            AssertWindowClosedWithDynamoView <PreferencesView>();
        }
示例#7
0
        public void PathsAddedToCustomPacakgePathPreferences_SurvivePreferenceDialogOpenClose()
        {
            //add a new path to the package paths
            Model.PreferenceSettings.CustomPackageFolders.Add(@"C:\doesNotExist");
            Model.PreferenceSettings.CustomPackageFolders.Add(@"C:\doesNotExist\dde.dll");

            //assert preference settings is correct after prefs window open and close.
            var preferencesWindow = new PreferencesView(View);

            //we use show because showDialog will block the test.
            preferencesWindow.Show();
            DispatcherUtil.DoEvents();
            preferencesWindow.CloseButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
            DispatcherUtil.DoEvents();

            //assert preference settings is correct.
            Assert.Contains(@"C:\doesNotExist", Model.PreferenceSettings.CustomPackageFolders);
            Assert.Contains(@"C:\doesNotExist\dde.dll", Model.PreferenceSettings.CustomPackageFolders);
        }