Esempio n. 1
0
        public void ShouldAddObjectToList()
        {
            SerializedProperty property = TestHelpers.GetProperty(nameof(TestHelpers.TestComponent.myCustomList));

            listElement = new ListElement(property);
            WindowFixture.RootElement.AddAndRemove(listElement, () =>
            {
                int initialSize             = property.arraySize;
                TestHelpers.TestObject test = ScriptableObject.CreateInstance <TestHelpers.TestObject>();
                listElement.AddNewItemToList(test);
                Assert.AreSame(test, listElement.GetPropertyAt(initialSize).objectReferenceValue);
            });
        }
Esempio n. 2
0
        public void WhenDisabled_ShouldNotWork()
        {
            SerializedProperty property = Property;

            listElement = new ListElement(property, new ListOptions {
                EnableAdditions = false
            });
            WindowFixture.RootElement.AddAndRemove(listElement, () =>
            {
                int initialSize = property.arraySize;
                listElement.AddNewItemToList();
                listElement.SendEvent(new ListResetEvent {
                    target = listElement
                });
                Assert.AreEqual(initialSize, listElement.Controls.ItemsSection.childCount);
            });
        }