Exemple #1
0
        public void ValidateWithGuidAttributeShouldReturnType()
        {
            var expected = typeof(B);
            var actual   = SerializableTypeDrawer.Validate(expected.GUID.ToString(), new GUIContent());

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void ValidateWithMissingGuidAttributeShouldReturnType()
        {
            var expected = typeof(A);
            var actual   = SerializableTypeDrawer.Validate(expected.AssemblyQualifiedName, new GUIContent());

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void ValidateWithInvalidTypeIDShouldSetError()
        {
            var expected   = EditorGUIUtility.IconContent("console.erroricon").image;
            var guiContent = new GUIContent();

            SerializableTypeDrawer.Validate("invalid", guiContent);
            var actual = guiContent.image;

            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void ValidateWithMissingGuidAttributeShouldSetWarning()
        {
            var expected   = EditorGUIUtility.IconContent("console.warnicon").image;
            var guiContent = new GUIContent();

            SerializableTypeDrawer.Validate(typeof(A).AssemblyQualifiedName, guiContent);
            var actual = guiContent.image;

            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void SetTypeValueShouldReturnSameType(Type expected)
        {
            var property       = GetProperty(nameof(NoTypeFilter));
            var typeIdProperty = property.FindPropertyRelative(TypeIdProperty);
            var setTypeValue   = SerializableTypeDrawer.SetTypeValue(typeIdProperty);

            setTypeValue(expected);
            var actual = SerializableTypeDrawer.Validate(typeIdProperty.stringValue, new GUIContent());

            Assert.AreEqual(expected, actual);
        }