public void GameObjectCanBeMigrated()
        {
            Type oldType = typeof(ManipulationHandler);
            Type newType = typeof(ObjectManipulator);
            Type migrationHandlerType = typeof(ObjectManipulatorMigrationHandler);

            GameObject gameObject = SetUpGameObjectWithComponentOfType(oldType);

            migrationTool.TryAddObjectForMigration(gameObject);
            migrationTool.MigrateSelection(migrationHandlerType, false);

            Assert.IsNull(gameObject.GetComponent(oldType), $"Migrated Component of type {oldType.Name} could not be removed");
            Assert.IsNotNull(gameObject.GetComponent(newType), $"Migrated Component of type {newType.Name} could not be added");

            GameObject.DestroyImmediate(gameObject);
        }
        private void DrawDeprecated()
        {
            List <Type> requiringTypes;

            if ((target as ManipulationHandler).gameObject.IsComponentRequired <ManipulationHandler>(out requiringTypes))
            {
                string requiringComponentNames = null;

                for (int i = 0; i < requiringTypes.Count; i++)
                {
                    requiringComponentNames += "- " + requiringTypes[i].FullName;
                    if (i < requiringTypes.Count - 1)
                    {
                        requiringComponentNames += '\n';
                    }
                }

                EditorGUILayout.HelpBox($"This component is deprecated. Please migrate object to up to date version. Remove the RequiredComponentAttribute from:\n{requiringComponentNames}", MessageType.Error);
                return;
            }

            EditorGUILayout.HelpBox("This component is deprecated. Please migrate object to up to date version", MessageType.Warning);
            if (GUILayout.Button("Migrate Object"))
            {
                MigrationTool migrationTool = new MigrationTool();

                var component = (ManipulationHandler)target;

                migrationTool.TryAddObjectForMigration(typeof(ObjectManipulatorMigrationHandler), (GameObject)component.gameObject);
                migrationTool.MigrateSelection(typeof(ObjectManipulatorMigrationHandler), true);
            }
        }
        public void GameObjectCanBeMigrated()
        {
            foreach (var entry in migrationList)
            {
                Type oldType = entry.oldType;
                Type newType = entry.newType;
                Type migrationHandlerType = entry.handler;

                GameObject gameObject = SetUpGameObjectWithComponentOfType(oldType);

                migrationTool.TryAddObjectForMigration(migrationHandlerType, gameObject);
                migrationTool.MigrateSelection(migrationHandlerType, false);

                Assert.IsNull(gameObject.GetComponent(oldType), $"Migrated Component of type {oldType.Name} could not be removed");
                Assert.IsNotNull(gameObject.GetComponent(newType), $"Migrated Component of type {newType.Name} could not be added");

                Object.DestroyImmediate(gameObject);
            }
        }
        public void ButtonMigrationTest()
        {
            Type     migrationHandlerType = typeof(ButtonConfigHelperMigrationHandler);
            Material testMat        = AssetDatabase.LoadAssetAtPath <Material>("Assets/MRTK/SDK/Features/UX/Interactable/Materials/HolographicButtonIconHome.mat");
            Material testDefaultMat = AssetDatabase.LoadAssetAtPath <Material>("Assets/MRTK/SDK/Features/UX/Interactable/Materials/HolographicButtonIconStar.mat");

            GameObject buttonGameObject = SetUpGameObjectWithComponentOfType(typeof(ButtonConfigHelper));
            GameObject buttonQuad       = GameObject.CreatePrimitive(PrimitiveType.Quad);

            buttonQuad.transform.parent = buttonGameObject.transform;

            MeshRenderer quadRenderer = buttonQuad.GetComponent <MeshRenderer>();

            quadRenderer.sharedMaterial = testMat;

            ButtonConfigHelper buttonConfig = buttonGameObject.GetComponent <ButtonConfigHelper>();
            ButtonIconSet      testIconSet  = new ButtonIconSet();

            buttonConfig.IconStyle = ButtonIconStyle.Quad;
            buttonConfig.IconSet   = testIconSet;
            buttonConfig.EditorSetDefaultIconSet(testIconSet);
            buttonConfig.EditorSetIconQuadRenderer(quadRenderer);
            buttonConfig.EditorSetDefaultQuadMaterial(testDefaultMat);

            migrationTool.TryAddObjectForMigration(migrationHandlerType, buttonGameObject);

            string testCustomIconSetFolder = System.IO.Path.Combine("Assets", "MixedRealityToolkit.Generated.Test");

            AssetDatabase.DeleteAsset(testCustomIconSetFolder);
            AssetDatabase.CreateFolder("Assets", "MixedRealityToolkit.Generated.Test");

            buttonConfig.EditorUpgradeCustomIcon(null, testCustomIconSetFolder, true);

            AssetDatabase.Refresh();
            ButtonIconSet generatedIconSet = AssetDatabase.LoadAssetAtPath <ButtonIconSet>(System.IO.Path.Combine("Assets", "MixedRealityToolkit.Generated.Test", "CustomIconSets", "CustomIconSet.asset"));

            Assert.IsNotNull(generatedIconSet);
            Assert.IsTrue(generatedIconSet.QuadIcons.Length == 1);

            AssetDatabase.DeleteAsset(testCustomIconSetFolder);
        }
        private void DrawDeprecated()
        {
            EditorGUILayout.HelpBox("This component is deprecated. Please migrate object to up to date version", UnityEditor.MessageType.Warning);
            if (GUILayout.Button("Migrate Object"))
            {
#if UNITY_EDITOR
                MigrationTool migrationTool = new MigrationTool();

                var component = (ManipulationHandler)target;

                migrationTool.TryAddObjectForMigration((GameObject)component.gameObject);
                migrationTool.MigrateSelection(typeof(ObjectManipulatorMigrationHandler), true);
#endif
            }
        }