コード例 #1
0
        public void Should_CreateEditor_ForBuiltinTypes(PropertyBlock block, object newValue)
        {
            var field = new ObjectPropertiesField();

            _window.rootVisualElement.Add(field);
            field.PropertyBlock = block;

            var helper = block as IGenericPropertyBlockHelper;
            var editor = field.Q(null, BaseField <int> .ussClassName);

            Assert.That(editor, Is.Not.Null);
            Assert.That(editor, Is.AssignableTo(helper.EditorType));

            helper.SetValueToField(editor, newValue);

            Assert.That(helper.PropertyBlockValue, Is.EqualTo(newValue));
        }
コード例 #2
0
        public void Should_CreateEditor_ForEnum()
        {
            var field = new ObjectPropertiesField();

            _window.rootVisualElement.Add(field);

            var block = new WithProperty <PortCapacity>();

            field.PropertyBlock = block;

            var editor = field.Q(null, BaseField <string> .ussClassName);

            Assert.That(editor, Is.Not.Null);
            Assert.That(editor, Is.AssignableTo(typeof(BaseField <string>)));

            (editor as BaseField <string>).value = PortCapacity.Multiple.ToString();

            Assert.That(block.Property, Is.EqualTo(PortCapacity.Multiple));
        }