Beispiel #1
0
        [Test] public void isCloneable()
        {
            double       xFactor      = 2.3;
            double       yFactor      = 3.4;
            Point        origLocation = new Point(30, 30);
            const string val          = "theValue";

            GuiProperty <string> original = new GuiProperty <string>(val, xFactor, yFactor);

            original.Location = origLocation;

            GuiProperty <string> clone = (GuiProperty <string>)original.Clone();

            original.Content = "newContents";
            original.Location.Offset(10, 10);
            original.LocationRelative.XFactor += 0.1;
            original.LocationRelative.YFactor += 0.1;

            // Use constant or hardcoded values in Assertions to avoid incorrect testing
            // due to the fact, that the references of the 'check' values just point
            // to the value being checked

            Assert.That(clone.LocationRelative.XFactor, Is.EqualTo(xFactor));
            Assert.That(clone.LocationRelative.YFactor, Is.EqualTo(yFactor));
            Assert.That(clone.Location, Is.EqualTo(new Point(30, 30)));
            Assert.That(clone.Content, Is.EqualTo(val));
        }
Beispiel #2
0
 public static void StaticSetGUIProperty(GuiProperty which, string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         value = " ";
     }
     GUIPropertyManager.SetProperty(StaticGetPropertyName(which.ToString()), value);
 }
Beispiel #3
0
        [Test] public void Constructor_with_LocationRelative_sets_Value_and_LocationRelative()
        {
            var    locationRelative = new RelativeLocation(2.3, 3.4);
            string val = "theValue";
            GuiProperty <string> prop = new GuiProperty <string>(val, locationRelative);

            Assert.That(prop.Content, Is.EqualTo(val));
            Assert.That(prop.LocationRelative, Is.EqualTo(locationRelative));
        }
Beispiel #4
0
        [Test] public void Constructor_with_Location_sets_Value_and_Location()
        {
            var    location           = new Point(10, 10);
            string val                = "theValue";
            GuiProperty <string> prop = new GuiProperty <string>(val, location);

            Assert.That(prop.Content, Is.EqualTo(val));
            Assert.That(prop.Location, Is.EqualTo(location));
        }
Beispiel #5
0
        [Test] public void Clone_clonesContentsIfItImplementsICloneable()
        {
            const string origString = "original";
            var          reference  = new CloneableClass(origString);
            var          original   = new GuiProperty <CloneableClass>(reference);

            var clone = (GuiProperty <CloneableClass>)original.Clone();

            clone.Content.check = "clone";

            Assert.That(original.Content.check, Is.EqualTo(origString));
        }
Beispiel #6
0
        [Test] public void Constructor_with_Doubles_sets_Value_and_LocationRelative()
        {
            double xFactor = 2.3;
            double yFactor = 3.4;

            string val = "theValue";
            GuiProperty <string> prop = new GuiProperty <string>(val, xFactor, yFactor);

            Assert.That(prop.Content, Is.EqualTo(val));
            Assert.That(prop.LocationRelative.XFactor, Is.EqualTo(xFactor));
            Assert.That(prop.LocationRelative.YFactor, Is.EqualTo(yFactor));
        }
Beispiel #7
0
        [Test] public void Constructor_with_Ints_sets_Value_and_Location()
        {
            int x = 3;
            int y = 4;

            string val = "theValue";
            GuiProperty <string> prop = new GuiProperty <string>(val, x, y);

            Assert.That(prop.Content, Is.EqualTo(val));
            Assert.That(prop.Location.X, Is.EqualTo(x));
            Assert.That(prop.Location.Y, Is.EqualTo(y));
        }
Beispiel #8
0
        [Test] public void isXmlSerializableAndSavesRelativeLocationOnly()
        {
            double       xFactor = 2.3;
            double       yFactor = 3.4;
            const string val     = "theValue";

            GuiProperty <string> original = new GuiProperty <string>(val, xFactor, yFactor);

            original.Location = new Point(20, 20);

            var deserialized = original.XmlDeserializedInMemory();

            Assert.That(deserialized.LocationRelative, Is.EqualTo(original.LocationRelative));
            Assert.That(deserialized.Content, Is.Not.EqualTo(original.Content));
            Assert.That(deserialized.Location, Is.Not.EqualTo(original.Location));
        }
Beispiel #9
0
 public void ClearGUIProperty(GuiProperty which)
 {
     this.ClearGUIProperty(which.ToString());
 }
Beispiel #10
0
 public void SetGUIProperty(GuiProperty which, string value)
 {
     this.SetGUIProperty(which.ToString(), value);
 }
 public void SetGUIProperty(GuiProperty which, string value)
 {
     this.SetGUIProperty(which.ToString(), value);
 }
 public void ClearGUIProperty(GuiProperty which)
 {
     this.ClearGUIProperty(which.ToString());
 }
Beispiel #13
0
 public string GetPropertyName(GuiProperty which)
 {
     return(this.GetPropertyName(which.ToString()));
 }
Beispiel #14
0
 public void SetGUIProperty(GuiProperty which, string value, bool isInternalMediaportal = false)
 {
     this.SetGUIProperty(which.ToString(), value, isInternalMediaportal);
 }
 public string GetPropertyName(GuiProperty which)
 {
     return this.GetPropertyName(which.ToString());
 }
 public static void StaticSetGUIProperty(GuiProperty which, string value)
 {
     if (string.IsNullOrEmpty(value))
     value = " ";
       GUIPropertyManager.SetProperty(StaticGetPropertyName(which.ToString()), value);
 }