public void DisplayImageSmallTest() { using var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); var image = CommonTestData.CreateSampleBitmap(result.Width / 2, result.Height / 2); var validBuffer = new List <byte> { (byte)Epd7In5_V2Commands.DataStartTransmission2 }; m_DataBuffer.Clear(); validBuffer.AddRange(SendBitmapToDevice(image, result.Width, result.Height)); validBuffer.Add((byte)Epd7In5_V2Commands.DisplayRefresh); validBuffer.Add((byte)Epd7In5_V2Commands.GetStatus); m_DataBuffer.Clear(); var bitmapEPaperDisplay = new SKBitmapLoader(result); bitmapEPaperDisplay.DisplayImage(image); Assert.AreEqual(validBuffer.Count, m_DataBuffer.Count, "Data Length is wrong"); Assert.IsTrue(m_DataBuffer.SequenceEqual(validBuffer), "Command Data Sequence is wrong"); }
public void ClearBlackTest() { using var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); m_DataBuffer.Clear(); result.ClearBlack(); const int pixelPerByte = 8; var displayBytes = result.Width / pixelPerByte * result.Height; const byte black = 0x01; var eightBlackPixel = result.MergePixelDataInByte(black, black, black, black, black, black, black, black); var validBuffer = new List <byte> { (byte)Epd7In5_V2Commands.DataStartTransmission2 }; for (int i = 0; i < displayBytes; i++) { validBuffer.Add(eightBlackPixel); } validBuffer.Add((byte)Epd7In5_V2Commands.DisplayRefresh); validBuffer.Add((byte)Epd7In5_V2Commands.GetStatus); Assert.IsTrue(m_DataBuffer.SequenceEqual(validBuffer), "Command Data Sequence is wrong"); }
public void DisplayImageSmallTest() { using var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); var image = CreateSampleBitmap(result.Width / 2, result.Height / 2); m_DataBuffer.Clear(); result.DisplayImage(image); var imageData = result.BitmapToData(image); var validBuffer = new List <byte> { (byte)Epd7In5_V2Commands.DataStartTransmission2 }; validBuffer.AddRange(imageData); validBuffer.Add((byte)Epd7In5_V2Commands.DataStop); validBuffer.Add((byte)Epd7In5_V2Commands.DisplayRefresh); validBuffer.Add((byte)Epd7In5_V2Commands.GetStatus); Assert.IsTrue(m_DataBuffer.SequenceEqual(validBuffer), "Command Data Sequence is wrong"); }
public void DoubleDisposeTest() { var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); result.Dispose(); result.Dispose(); }
public void FinalizerTest() { var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); Assert.NotNull(result, "Object should not be null"); // ReSharper disable once RedundantAssignment #pragma warning disable IDE0059 // Unnecessary assignment of a value result = null; #pragma warning restore IDE0059 // Unnecessary assignment of a value GC.Collect(); GC.WaitForPendingFinalizers(); }
public void PowerOffTest() { using var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); m_DataBuffer.Clear(); result.PowerOff(); var validBuffer = new List <byte> { (byte)Epd7In5_V2Commands.PowerOff, (byte)Epd7In5_V2Commands.GetStatus }; Assert.IsTrue(m_DataBuffer.SequenceEqual(validBuffer), "Command Data Sequence is wrong"); }
public void WakeUpTest() { using var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); m_DataBuffer.Clear(); result.WakeUp(); var validBuffer = new List <byte> { (byte)Epd7In5_V2Commands.BoosterSoftStart, 0x17, 0x17, 0x27, 0x17, (byte)Epd7In5_V2Commands.PowerSetting, 0x07, 0x17, 0x3f, 0x3f, (byte)Epd7In5_V2Commands.PowerOn, (byte)Epd7In5_V2Commands.GetStatus, (byte)Epd7In5_V2Commands.PanelSetting, 0x1F, (byte)Epd7In5_V2Commands.TconResolution, 0x03, 0x20, 0x01, 0xe0, (byte)Epd7In5_V2Commands.DualSpi, 0x00, (byte)Epd7In5_V2Commands.VcomAndDataIntervalSetting, 0x10, 0x07, (byte)Epd7In5_V2Commands.TconSetting, 0x22 }; Assert.IsTrue(m_DataBuffer.SequenceEqual(validBuffer), "Command Data Sequence is wrong"); }
//######################################################################################## #region Public Methods /// <summary> /// Create a instance of a E-Paper Display /// </summary> /// <param name="displayType"></param> /// <returns></returns> public static IEPaperDisplay Create(EPaperDisplayType displayType) { IEPaperDisplayInternal display; switch (displayType) { case EPaperDisplayType.WaveShare7In5Bc: display = new Epd7In5Bc(); break; case EPaperDisplayType.WaveShare7In5_V2: display = new Epd7In5_V2(); break; default: display = null; break; } display?.Initialize(EPaperDisplayHardware.Value); return(display); }
public void DisposeNoHardwareTest() { using var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); }
public void ConstructorTest() { using var result = new Epd7In5_V2(); result.Initialize(m_EPaperDisplayHardwareMock.Object); }