Skip to content

Commit 5d4f85e

Browse files
committed
Test high-res PNG export
1 parent a77d040 commit 5d4f85e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/org/labkey/test/tests/visualization/GenericChartsTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,22 @@
2222
import org.labkey.test.components.ChartLayoutDialog;
2323
import org.labkey.test.pages.TimeChartWizard;
2424
import org.labkey.test.tests.ReportTest;
25+
import org.labkey.test.util.CodeMirrorHelper;
2526
import org.labkey.test.util.Ext4Helper;
2627
import org.labkey.test.util.LogMethod;
2728
import org.openqa.selenium.WebElement;
2829
import org.openqa.selenium.support.ui.ExpectedConditions;
2930

31+
import javax.imageio.ImageIO;
32+
import java.awt.image.BufferedImage;
3033
import java.io.File;
34+
import java.io.IOException;
3135
import java.util.ArrayList;
3236
import java.util.HashMap;
3337
import java.util.List;
3438
import java.util.Map;
3539

40+
import static org.hamcrest.number.OrderingComparison.greaterThanOrEqualTo;
3641
import static org.junit.Assert.assertFalse;
3742
import static org.junit.Assert.assertTrue;
3843

@@ -158,11 +163,21 @@ protected Map<String, File> export(String type, String xAxis, String yAxis)
158163
log("Export as PNG");
159164
File png = clickExportPNGIcon("chart-render-div", 0);
160165
exported.put("png", png);
166+
try
167+
{
168+
BufferedImage image = ImageIO.read(png);
169+
// Issue 53390: Improve resolution of PNG exports
170+
checker().verifyThat("Exported PNG height", image.getHeight(), greaterThanOrEqualTo(2000));
171+
}
172+
catch (IOException e)
173+
{
174+
checker().recordError(new RuntimeException("Failed to read exported PNG: " + png, e));
175+
}
161176

162177
log("Export to script.");
163178
Assert.assertEquals("Unexpected number of export script icons", 1, getExportScriptIconCount("chart-render-div"));
164179
clickExportScriptIcon("chart-render-div", 0);
165-
String exportScript = _extHelper.getCodeMirrorValue("export-script-textarea");
180+
String exportScript = new CodeMirrorHelper(this, "export-script-textarea").getCodeMirrorValue();
166181

167182
log("Validate that the script is as expected.");
168183
assertTrue("Script did not contain expected text: '" + type + "' ", exportScript.toLowerCase().contains(type.toLowerCase()));

0 commit comments

Comments
 (0)