From 47b58eb24a1750d34c544006d94d341f527eb1d5 Mon Sep 17 00:00:00 2001 From: sveinungf Date: Sat, 2 Dec 2023 23:59:27 +0100 Subject: [PATCH 1/2] Test for embedding image with invalid resolution --- SpreadCheetah.Test/Images/red-1x1.invalidpng | Bin 0 -> 119 bytes .../Tests/SpreadsheetImageTests.cs | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 SpreadCheetah.Test/Images/red-1x1.invalidpng diff --git a/SpreadCheetah.Test/Images/red-1x1.invalidpng b/SpreadCheetah.Test/Images/red-1x1.invalidpng new file mode 100644 index 0000000000000000000000000000000000000000..4e6285425d5593fe50cc156f182db12efa116c7b GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0y~yY+J~{z{tqK1QeN29()f-F%}28J29*~C-V}>VM%xN zb!1@J*w6hZkrl}2EbxddW?&F10b#~_Y4R07K^{*R#}J9| literal 0 HcmV?d00001 diff --git a/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs b/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs index 9e3d3af2..7296d4db 100644 --- a/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs +++ b/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs @@ -139,6 +139,22 @@ public async Task Spreadsheet_EmbedImage_PngFromReadOnlyStream() Assert.Null(exception); } + [Fact] + public async Task Spreadsheet_EmbedImage_PngWithInvalidResolution() + { + // Arrange + using var pngStream = EmbeddedResources.GetStream("red-1x1.invalidpng"); + using var outputStream = new MemoryStream(); + await using var spreadsheet = await Spreadsheet.CreateNewAsync(outputStream); + + // Act + var exception = await Record.ExceptionAsync(() => spreadsheet.EmbedImageAsync(pngStream).AsTask()); + + // Assert + var concreteException = Assert.IsType(exception); + Assert.Contains("width", concreteException.Message, StringComparison.OrdinalIgnoreCase); + } + [Fact] public async Task Spreadsheet_AddImage_Png() { @@ -675,6 +691,5 @@ public async Task Spreadsheet_AddImage_PngWithFillCellsAndOffsets(int left, int Assert.Equal(expectedHeight, actualHeight); } - // TODO: Test for embedding image with invalid dimensions // TODO: Test for transparent image } From 16ac8de11aef8f8a9beb33354a79a78a91107750 Mon Sep 17 00:00:00 2001 From: sveinungf Date: Sun, 3 Dec 2023 00:11:03 +0100 Subject: [PATCH 2/2] Test for adding image with transparent background --- .../Images/yellow-500x500-transparent.png | Bin 0 -> 28532 bytes .../Tests/SpreadsheetImageTests.cs | 33 ++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 SpreadCheetah.Test/Images/yellow-500x500-transparent.png diff --git a/SpreadCheetah.Test/Images/yellow-500x500-transparent.png b/SpreadCheetah.Test/Images/yellow-500x500-transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..f35ec87034f190400f47a49571a8a2f7f4fa67ed GIT binary patch literal 28532 zcmeFZ^;gtg_dg87kkTzkmxP1}NDMI2BB0U@BBCG-0z(fxgl=+o>cOh@v3vBYBo6bpGPu>xgB|uiu|&eE(_nwCr{^KLO9D>?indjOBCLxpFD1 zaR|oE&3xy_&8JVq#AjA^6O1SHXNJYiXY?V%`bYQPIvMB~>Kg{!Z)i^csv{rEH?1B7 z{`cdi)7s}xY=lG2j{EN?3sFTCheLexQN$&Bin{eQLJ0KFk2u6nQ4<9J`6dDfd>4bC zuS_5OA3}FAZ}GSlK{ubLI3QXqNRKn>-yao0v>rA8p-z1l2bTnfD-f^p-~C8rrvBXx zhnO}92fqpDOE2et_Q%0bcl1ZpiT8h}_kWiYFo^%3+n)6%5m@IXg}i_4j}^~?Urx(q z8u-3&TJ@4tUvITso9nZ2ia5fBdRVjFu@~2w^`G7Eu{PMF$$RIklTA2=aYhHo3(Lh_ zNqqI@3AP{ldja^)%0H7fPp7nUH}4LRy&;g28@g2!BdPEetZv116i zvq4W;-z&G^-uA}>8TD+Y{FI2$5Wom5OBx2B*fLuOXU-B*-ok}9ys#+(be+z94|NYeqH7_=1c5=QHYRlCA`I+U!rWp zQgP2x-SfiTr{eI#mc<`7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Thxc?(APae>Sd6SOHCb<# zoZ3Opp~oHR*SeaZ4Xx22#}Sm)oXj$wIDuoW=)HkG>5j={#*`Un9ek-+ANE2skGH}} zR~vB>Tk(owhZhEeU(*M>K(N-qqjGXRU>3+d;u6zWS7xte7@zYPq~YB-*1i!#J{7?i zKjL(TJpK+)RL$Y|xi=WRrRL0UH9dWx|IpzLWwOUC%jP)za3+k{v=NM*G7tuxZ7~G+ zA|Hj;#my;A^Ak)fycr9GP%0Ki_k6fk?OGg+{Q)Ci!J48yx0|;GzS1l4E)NQ%O&p5D z$_h?)HYuYUhPw|Gc)bZ$*2}HYpY8JRRB&W}i}{hk2|0j1(Ga3Hh_{k*im~zBoTJpj38)_}r9WRY!V&LE+L| zBFH9BFiN@RY$rJvF!XjK?)C4++SvOQ_YF)McMaH(3@-h3kM^&uC!*E*c|~+KWV?6Ya11&{NpX3gbm8#8o#c;xbGf(|9#YwM!%<^Y!6dzDkF?T-cF8c zVU|{oC*Pl4u%ZogsE&x+cs7F(LSzZD4ty?$+>wku=;-ioVY{q-7%|pjzM%E?KOLs% z0Nn?#X7t9tKPWStd(b}Asn__oI~2!xJBC+G(?b8Ws|w*hx8lut;~)2LXDJDQ$B5wI zZ_xj{&lRA~0y5=JZJWwxFwF&(nC`BBa literal 0 HcmV?d00001 diff --git a/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs b/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs index 7296d4db..351a437a 100644 --- a/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs +++ b/SpreadCheetah.Test/Tests/SpreadsheetImageTests.cs @@ -186,6 +186,37 @@ public async Task Spreadsheet_AddImage_Png() Assert.Equal("Image 1", picture.Name); } + [Fact] + public async Task Spreadsheet_AddImage_PngWithTransparentBackground() + { + // Arrange + const string reference = "B3"; + using var pngStream = EmbeddedResources.GetStream("yellow-500x500-transparent.png"); + using var outputStream = new MemoryStream(); + await using var spreadsheet = await Spreadsheet.CreateNewAsync(outputStream); + var embeddedImage = await spreadsheet.EmbedImageAsync(pngStream); + await spreadsheet.StartWorksheetAsync("Sheet 1"); + var canvas = ImageCanvas.OriginalSize(reference.AsSpan()); + + // Act + spreadsheet.AddImage(canvas, embeddedImage); + + // Assert + await spreadsheet.FinishAsync(); + SpreadsheetAssert.Valid(outputStream); + + using var workbook = new XLWorkbook(outputStream); + var worksheet = Assert.Single(workbook.Worksheets); + var picture = Assert.Single(worksheet.Pictures); + Assert.Equal(reference, picture.TopLeftCell.Address.ToString()); + Assert.Equal(XLPictureFormat.Png, picture.Format); + Assert.Equal(500, picture.OriginalWidth); + Assert.Equal(500, picture.OriginalHeight); + Assert.Equal(0, picture.Top); + Assert.Equal(0, picture.Left); + Assert.Equal("Image 1", picture.Name); + } + [Fact] public async Task Spreadsheet_AddImage_PngWithLargeResolution() { @@ -690,6 +721,4 @@ public async Task Spreadsheet_AddImage_PngWithFillCellsAndOffsets(int left, int Assert.Equal(expectedWidth, actualWidth); Assert.Equal(expectedHeight, actualHeight); } - - // TODO: Test for transparent image }