public void ScaleImageReturnsNewImageWithCorrectlyScaledHeight() { var graphics = Substitute.For <IGraphicsProvider>(); graphics.GetResolutionScalingFactor().Returns(new SizeF(4, 2)); var sut = new DisplayProperties(graphics); var initialValue = Resources.TestImage; var scaledValue = sut.ScaleImage(initialValue); Assert.That(scaledValue.Height, Is.EqualTo(sut.ResolutionScalingFactor.Height * initialValue.Height)); }
private void frmPassword_Load(object sender, EventArgs e) { ApplyLanguage(); ApplyTheme(); var display = new DisplayProperties(); pbLock.Image = display.ScaleImage(pbLock.Image); Height = tableLayoutPanel1.Height; if (NewPasswordMode) { return; } lblVerify.Visible = false; txtVerify.Visible = false; }
private object ImageGetter(object rowobject) { var page = rowobject as OptionsPage; return(page?.PageIcon == null?_display.ScaleImage(Resources.Help) : _display.ScaleImage(page.PageIcon)); }
public void AttemptingToScaleANullIconWillThrowAnException() { var sut = new DisplayProperties(Substitute.For <IGraphicsProvider>()); Assert.Throws <ArgumentNullException>(() => sut.ScaleImage((Icon)null)); }