Scrollbar CenterValue Property Delta Engine Documentation

Namespace: DeltaEngine.Scenes.Controls
Assembly: DeltaEngine.Scenes (in DeltaEngine.Scenes.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public int CenterValue { get; set; }

Property Value

Type: Int32
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.ScrollbarTests
Examples

4 unit tests call DeltaEngine.Scenes.Controls.Scrollbar.CenterValue
[Test, CloseAfterFirstFrame]
public void DefaultValues()
{
    Assert.AreEqual(0, scrollbar.MinValue);
    Assert.AreEqual(99, scrollbar.MaxValue);
    Assert.AreEqual(10, scrollbar.ValueWidth);
    Assert.AreEqual(90, scrollbar.LeftValue);
    Assert.AreEqual(95, scrollbar.CenterValue);
    Assert.AreEqual(99, scrollbar.RightValue);
}
[Test, CloseAfterFirstFrame]
public void UpdateValues()
{
    scrollbar.MinValue = 1;
    scrollbar.MaxValue = 10;
    scrollbar.ValueWidth = 2;
    scrollbar.CenterValue = 4;
    Assert.AreEqual(1, scrollbar.MinValue);
    Assert.AreEqual(10, scrollbar.MaxValue);
    Assert.AreEqual(4, scrollbar.CenterValue);
    Assert.AreEqual(2, scrollbar.ValueWidth);
}
[Test, CloseAfterFirstFrame]
public void SaveAndLoad()
{
    scrollbar.CenterValue = 20;
    var stream = BinaryDataExtensions.SaveToMemoryStream(scrollbar);
    var loadedScrollbar = (Scrollbar)stream.CreateFromMemoryStream();
    Assert.AreEqual(center, loadedScrollbar.DrawArea);
    Assert.AreEqual(20, loadedScrollbar.CenterValue);
    Assert.AreEqual(scrollbar.Get<Picture>().Material.DefaultColor,
        loadedScrollbar.Get<Picture>().Material.DefaultColor);
}
See Also