public void ClearBlackTest() { using var result = new Epd7In5Bc(); result.Initialize(m_EPaperDisplayHardwareMock.Object); m_DataBuffer.Clear(); result.ClearBlack(); const int pixelPerByte = 2; var displayBytes = result.Width / pixelPerByte * result.Height; const byte black = 0x00; var twoBlackPixel = result.MergePixelDataInByte(black, black); var validBuffer = new List <byte> { (byte)Epd7In5BcCommands.DataStartTransmission1 }; for (int i = 0; i < displayBytes; i++) { validBuffer.Add(twoBlackPixel); } validBuffer.Add((byte)Epd7In5BcCommands.DataStop); validBuffer.Add((byte)Epd7In5BcCommands.PowerOn); validBuffer.Add((byte)Epd7In5BcCommands.GetStatus); validBuffer.Add((byte)Epd7In5BcCommands.DisplayRefresh); validBuffer.Add((byte)Epd7In5BcCommands.GetStatus); Assert.IsTrue(m_DataBuffer.SequenceEqual(validBuffer), "Command Data Sequence is wrong"); }
public void TestMergePixelDataInByte() { using var result = new Epd7In5Bc(); var random = new Random(); for (int i = 0; i < 200; i++) { var b1 = (byte)random.Next(0, 0x0F); var b2 = (byte)random.Next(0, 0x0F); var oldResult = MergePixelDataInByte(b1, b2); var newResult = result.MergePixelDataInByte(b1, b2); Assert.AreEqual(oldResult, newResult, $"Merged Byte Run {i} is wrong. Expected {oldResult}, Returned {newResult}"); } }