コード例 #1
0
        public void Read__Reading_A_Valid_Layer()
        {
            layer = new Layer();
            layer.Read(File.ReadAllBytes("Content/Tests/Layer/Layer-Data.bin"));

            Assert.AreEqual("Layer Name", layer.Name);
            Assert.AreEqual(10, layer.Index);
            Assert.IsTrue(layer.IsVisible);
            Assert.AreEqual(0x10, layer.Color.Red);
            Assert.AreEqual(0x20, layer.Color.Green);
            Assert.AreEqual(0x30, layer.Color.Blue);
            Assert.AreEqual(0x40, layer.Color.Alpha);
        }
コード例 #2
0
 public ILayer CreateLayer()
 {
     ILayer layer;
     if (CreateLayerDelegate == null)
     {
         layer = new Layer();
     }
     else
     {
         layer = CreateLayerDelegate();
     }
     return layer;
 }
コード例 #3
0
        public void Write__Writting_A_Valid_Layer()
        {
            layer = new Layer();

            layer.Index = 10;
            layer.IsVisible = true;
            layer.Name = "Layer Name";
            layer.Color = new ColorRgba(0x10, 0x20, 0x30, 0x40);

            byte[] writtenData = layer.Write();
            byte[] expected = File.ReadAllBytes("Content/Tests/Layer/Layer-Data.bin");

            Assert.AreEqual(BitConverter.ToString(expected), BitConverter.ToString(writtenData));
        }
コード例 #4
0
        public void Constructor__Set_Color_To_An_Instance()
        {
            layer = new Layer();

            Assert.IsNotNull(layer.Color);
        }
コード例 #5
0
ファイル: Map.cs プロジェクト: DamienHauta/NS2-Map-Extract
 public ILayer GetOrCreateLayer(string layerName)
 {
     ILayer layer =
         (from lyr in Layers
             where lyr.Name == layerName
             select lyr).FirstOrDefault();
     if (layer == null)
     {
         layer = new Layer();
         layer.Name = layerName;
         layer.Index = NextLayerIndex();
         Layers.Add(layer);
     }
     return layer;
 }