public void WhenNameIsEqualToTemplateName_ShouldNotAddStyleSheet() { VisualElement element = new VisualElement(); Handler.LoadAndAddStyleSheet(element, ListOptions.DefaultStyleSheetName, ListOptions.DefaultTemplateName); Assert.AreEqual(0, element.styleSheets.count); }
public void WhenNameIsNotEqualToTemplateName_ShouldAddStylesheet() { VisualElement element = new VisualElement(); Handler.LoadAndAddStyleSheet(element, TestHelpers.DefaultTestTemplateName, ListOptions.DefaultTemplateName); Assert.AreEqual(1, element.styleSheets.count); }
public void WhenReplacingObjectFieldLabelAndFieldIsEmpty_ShouldNotThrowError() { ObjectField objectField = new ObjectField(); objectField.hierarchy.RemoveAt(0); Handler.InsertLabelInObjectField(objectField, "Test"); }
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); }
public void WhenShowIsFalse_ShouldChangeElements() { ElementPair elements = new ElementPair(true); Handler.SetConfirmSectionVisibility(elements.Button, elements.Section, false); elements.AssertDisplayState(); }
public void WhenSettingToTheSameState_ShouldNotChangeElements() { ElementPair elements = new ElementPair(); Handler.SetConfirmSectionVisibility(elements.Button, elements.Section, false); elements.AssertDisplayState(); }
public void WhenIndexIsZero_ShouldSetEnabledFalse() { Button moveUp = new Button(); Handler.SetButtonStateBasedOnZeroIndex(moveUp, 0); Assert.IsFalse(moveUp.enabledSelf); }
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); }
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); }
public void WhenOneElementIsNull_ShouldFailSilentlyAndNotChangeElement() { ElementPair elements = new ElementPair(); Handler.SetConfirmSectionVisibility(elements.Button, null, true); Handler.SetConfirmSectionVisibility(null, elements.Section, true); elements.AssertDisplayState(); }
public void WhenIndexIsNotZero_ShouldSetEnabledTrue() { Button moveUp = new Button(); moveUp.SetEnabled(false); Handler.SetButtonStateBasedOnZeroIndex(moveUp, 1); Assert.IsTrue(moveUp.enabledSelf); }
public void WhenOptionsLabelSet_ShouldUseOptionsLabel() { const string optionsLabel = "Test"; Label label = new Label(); Handler.SetHeaderLabelText(label, null, optionsLabel); Assert.AreEqual( optionsLabel, label.text); }
public void WhenOptionsLabelNotSet_ShouldUseListName() { const string listName = "Test"; Label label = new Label(); Handler.SetHeaderLabelText(label, listName, null); Assert.AreEqual( listName, label.text); }
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); }
public void WhenElementIsNull_ShouldFailSilently() { Handler.SetAddObjectFieldValueToNull(null); }
public void WhenLabelIsNull_ShouldNotThrowError() { Handler.SetHeaderLabelText(null, null, null); }
public void WhenButtonIsNull_ShouldNotThrowError() { Handler.SetButtonStateBasedOnZeroIndex(null, 0); Assert.Pass(); }
public void WhenElementsAreNull_ShouldFailSilently() { Handler.SetConfirmSectionVisibility(null, null, false); }
public void WhenButtonIsNull_ShouldNotThrowError() { Handler.SetButtonStateBasedOnBeingLastPositionInArray(null, 1, 2); Assert.Pass(); }
public void WhenSettingTypeOnNull_ShouldNotError() { Handler.SetTypeOnObjectField(null, typeof(TestHelpers.TestObject)); }
public void WhenReplacingObjectFieldLabelAndFieldIsNull_ShouldNotThrowError() { Handler.InsertLabelInObjectField(null, "Test"); }