コード例 #1
0
        public void WhenNameIsEqualToTemplateName_ShouldNotAddStyleSheet()
        {
            VisualElement element = new VisualElement();

            Handler.LoadAndAddStyleSheet(element, ListOptions.DefaultStyleSheetName, ListOptions.DefaultTemplateName);
            Assert.AreEqual(0, element.styleSheets.count);
        }
コード例 #2
0
        public void WhenNameIsNotEqualToTemplateName_ShouldAddStylesheet()
        {
            VisualElement element = new VisualElement();

            Handler.LoadAndAddStyleSheet(element, TestHelpers.DefaultTestTemplateName, ListOptions.DefaultTemplateName);
            Assert.AreEqual(1, element.styleSheets.count);
        }
コード例 #3
0
        public void WhenReplacingObjectFieldLabelAndFieldIsEmpty_ShouldNotThrowError()
        {
            ObjectField objectField = new ObjectField();

            objectField.hierarchy.RemoveAt(0);
            Handler.InsertLabelInObjectField(objectField, "Test");
        }
コード例 #4
0
        public void WhenSettingObjectFieldLabel_ShouldHaveAdditionalLabelWithText()
        {
            ObjectField objectField = new ObjectField();

            Handler.InsertLabelInObjectField(objectField, "Test");
            Assert.AreEqual("Test",
                            (objectField.hierarchy[0].hierarchy[0].hierarchy[2] as Label)?.text);
        }
コード例 #5
0
        public void WhenShowIsFalse_ShouldChangeElements()
        {
            ElementPair elements = new ElementPair(true);

            Handler.SetConfirmSectionVisibility(elements.Button, elements.Section, false);

            elements.AssertDisplayState();
        }
コード例 #6
0
        public void WhenSettingToTheSameState_ShouldNotChangeElements()
        {
            ElementPair elements = new ElementPair();

            Handler.SetConfirmSectionVisibility(elements.Button, elements.Section, false);

            elements.AssertDisplayState();
        }
コード例 #7
0
        public void WhenIndexIsZero_ShouldSetEnabledFalse()
        {
            Button moveUp = new Button();

            Handler.SetButtonStateBasedOnZeroIndex(moveUp, 0);

            Assert.IsFalse(moveUp.enabledSelf);
        }
コード例 #8
0
        public void WhenStylesheetDoesNotExist_ShouldShowWarning()
        {
            VisualElement element = new VisualElement();

            Handler.LoadAndAddStyleSheet(element, "TEST43325416436231", ListOptions.DefaultTemplateName);

            LogAssert.Expect(LogType.Warning, new Regex(".*\n*.*\n*.*\n*.*\n*.*\n*.*\n*.*\n*.*\n*.*"));
        }
        public void WhenIndexIsLastPosition_ShouldSetEnabledFalse()
        {
            Button moveDown = new Button();

            Handler.SetButtonStateBasedOnBeingLastPositionInArray(moveDown, 1, 2);

            Assert.IsFalse(moveDown.enabledSelf);
        }
コード例 #10
0
        public void WhenSettingTypeOnObjectField_ShouldSetTypeToTypeProvided()
        {
            ObjectField field = new ObjectField();

            Handler.SetTypeOnObjectField(field, typeof(TestHelpers.TestObject));
            Assert.AreSame(
                typeof(TestHelpers.TestObject),
                field.objectType);
        }
        public void WhenIndexIsNotLastPosition_ShouldSetEnabledTrue()
        {
            Button moveDown = new Button();

            moveDown.SetEnabled(false);
            Handler.SetButtonStateBasedOnBeingLastPositionInArray(moveDown, 0, 2);

            Assert.IsTrue(moveDown.enabledSelf);
        }
コード例 #12
0
        public void WhenOneElementIsNull_ShouldFailSilentlyAndNotChangeElement()
        {
            ElementPair elements = new ElementPair();

            Handler.SetConfirmSectionVisibility(elements.Button, null, true);
            Handler.SetConfirmSectionVisibility(null, elements.Section, true);

            elements.AssertDisplayState();
        }
コード例 #13
0
        public void WhenIndexIsNotZero_ShouldSetEnabledTrue()
        {
            Button moveUp = new Button();

            moveUp.SetEnabled(false);
            Handler.SetButtonStateBasedOnZeroIndex(moveUp, 1);

            Assert.IsTrue(moveUp.enabledSelf);
        }
コード例 #14
0
        public void WhenOptionsLabelSet_ShouldUseOptionsLabel()
        {
            const string optionsLabel = "Test";
            Label        label        = new Label();

            Handler.SetHeaderLabelText(label, null, optionsLabel);
            Assert.AreEqual(
                optionsLabel,
                label.text);
        }
コード例 #15
0
        public void WhenOptionsLabelNotSet_ShouldUseListName()
        {
            const string listName = "Test";
            Label        label    = new Label();

            Handler.SetHeaderLabelText(label, listName, null);
            Assert.AreEqual(
                listName,
                label.text);
        }
コード例 #16
0
        public void ShouldSetToNull()
        {
            ObjectField objectField = new ObjectField
            {
                value = ScriptableObject.CreateInstance <TestHelpers.TestComponent>()
            };

            if (objectField is null)
            {
                Assert.Fail("Object field is null before method call");
            }

            Handler.SetAddObjectFieldValueToNull(objectField);

            Assert.IsNull(objectField.value);
        }
コード例 #17
0
 public void WhenElementIsNull_ShouldFailSilently()
 {
     Handler.SetAddObjectFieldValueToNull(null);
 }
コード例 #18
0
 public void WhenLabelIsNull_ShouldNotThrowError()
 {
     Handler.SetHeaderLabelText(null, null, null);
 }
コード例 #19
0
        public void WhenButtonIsNull_ShouldNotThrowError()
        {
            Handler.SetButtonStateBasedOnZeroIndex(null, 0);

            Assert.Pass();
        }
コード例 #20
0
 public void WhenElementsAreNull_ShouldFailSilently()
 {
     Handler.SetConfirmSectionVisibility(null, null, false);
 }
        public void WhenButtonIsNull_ShouldNotThrowError()
        {
            Handler.SetButtonStateBasedOnBeingLastPositionInArray(null, 1, 2);

            Assert.Pass();
        }
コード例 #22
0
 public void WhenSettingTypeOnNull_ShouldNotError()
 {
     Handler.SetTypeOnObjectField(null, typeof(TestHelpers.TestObject));
 }
コード例 #23
0
 public void WhenReplacingObjectFieldLabelAndFieldIsNull_ShouldNotThrowError()
 {
     Handler.InsertLabelInObjectField(null, "Test");
 }