public void Copy_SameSizeRegion_IntoBigger() { new SadConsole.Tests.BasicGameHost(); var surface1 = new SadConsole.CellSurface(20, 20); var surface2 = new SadConsole.CellSurface(22, 22); ColoredGlyph defaultCell = new ColoredGlyph(); surface2[0].CopyAppearanceTo(defaultCell); surface1.FillWithRandomGarbage(255); surface1.Copy(surface2); for (int y = 0; y < surface2.Height; y++) { for (int x = 0; x < surface2.Width; x++) { if (x > surface1.Width - 1 || y > surface1.Height - 1) { Assert.IsTrue(surface2[x, y].Matches(defaultCell)); } else { Assert.IsTrue(surface1[x, y].Matches(surface2[x, y])); } } } }
public void Copy_SameSizeRegion_Exact() { new SadConsole.Tests.BasicGameHost(); var surface1 = new SadConsole.CellSurface(20, 20); var surface2 = new SadConsole.CellSurface(20, 20); surface1.FillWithRandomGarbage(255); surface1.Copy(surface2); for (int i = 0; i < surface1.Cells.Length; i++) { Assert.IsTrue(surface1[i].Matches(surface2[i])); } }
public void Glyph_SetGlyph() { new SadConsole.Tests.BasicGameHost(); var surface1 = new SadConsole.CellSurface(20, 20); surface1.FillWithRandomGarbage(255); int newGlyph = new System.Random().Next(0, 256); Assert.IsFalse(newGlyph == surface1[0, 0].Glyph); surface1.SetGlyph(0, 0, newGlyph); Assert.IsTrue(newGlyph == surface1[0, 0].Glyph); }
public void Glyph_SetBackground() { new SadConsole.Tests.BasicGameHost(); var surface1 = new SadConsole.CellSurface(20, 20); surface1.FillWithRandomGarbage(255); Color newBackground = Color.Blue.GetRandomColor(new System.Random()); Assert.IsFalse(newBackground == surface1[0, 0].Background); surface1.SetBackground(0, 0, newBackground); Assert.IsTrue(newBackground == surface1[0, 0].Background); }
public void Glyph_SetMirror() { new SadConsole.Tests.BasicGameHost(); var surface1 = new SadConsole.CellSurface(20, 20); surface1.FillWithRandomGarbage(255); Mirror cellMirror = surface1[0].Mirror; Mirror newMirror = cellMirror switch { Mirror.None => Mirror.Horizontal, Mirror.Horizontal => Mirror.Vertical, _ => Mirror.None }; Assert.IsFalse(newMirror == surface1[0, 0].Mirror); surface1.SetMirror(0, 0, newMirror); Assert.IsTrue(newMirror == surface1[0, 0].Mirror); }