public void CaptureDesktopOneFrame() { using var cts = new CancellationTokenSource(); foreach (var desktopFrame in _desktopDuplicator.DuplicateDesktop(cts.Token)) { cts.Cancel(); } }
public void CanGetPointerImageFromDesktopFrame() { var mapJson = File.ReadAllText("./mocks/alignmentmap.json"); var map = JsonConvert.DeserializeObject <IList <int> >(mapJson); using var cts = new CancellationTokenSource(); var desktopDuplicator = new DesktopDuplicator(_mockLogger.Object); var settings = new MatrixSettings() { Map = map, DataFormat = DataMatrixFormat.Raw }; foreach (var desktopFrame in desktopDuplicator.DuplicateDesktop(cts.Token)) { var pointerImage = desktopFrame.GetPointerImage(); //Erm, move the mouse around to get an updated cursor image. if (pointerImage != null) { //Assert.StartsWith("data:image/png;base64,", pointerImage); cts.Cancel(); } } Assert.True(true); }
public void CanCreateThumbnailFromDesktopFrame() { var mapJson = File.ReadAllText("./mocks/alignmentmap.json"); var map = JsonConvert.DeserializeObject <IList <int> >(mapJson); using var cts = new CancellationTokenSource(); var desktopDuplicator = new DesktopDuplicator(_mockLogger.Object); var settings = new MatrixSettings() { Map = map, DataFormat = DataMatrixFormat.Raw }; foreach (var desktopFrame in desktopDuplicator.DuplicateDesktop(cts.Token)) { var width = (int)Math.Ceiling(desktopFrame.DesktopWidth * 0.15); var height = (int)Math.Ceiling(desktopFrame.DesktopHeight * 0.15); var thumbby = desktopFrame.GetThumbnailImage(width, height); Assert.True(thumbby.Length > 0); cts.Cancel(); } Assert.True(true); }
public void CanDecodeDesktopFrame() { var mapJson = File.ReadAllText("./mocks/alignmentmap.json"); var map = JsonConvert.DeserializeObject <IList <int> >(mapJson); using var cts = new CancellationTokenSource(); var desktopDuplicator = new DesktopDuplicator(_mockLogger.Object); var settings = new MatrixSettings() { Map = map, DataFormat = DataMatrixFormat.Raw }; foreach (var desktopFrame in desktopDuplicator.DuplicateDesktop(cts.Token)) { var frame = desktopFrame.DecodeMatrixFrame(settings); if (frame != null) { cts.Cancel(); } } Assert.True(true); }
public void CanCaptureDesktop() { using var cts = new CancellationTokenSource(); var desktopDuplicator = new DesktopDuplicator(_mockLogger.Object); foreach (var desktopFrame in desktopDuplicator.DuplicateDesktop(cts.Token)) { Assert.NotNull(desktopFrame); Assert.False(desktopFrame.IsDesktopImageBufferEmpty); cts.Cancel(); } Assert.True(true); }