Skip to content

Commit

Permalink
GH-146 QA capture framework (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcorless authored Dec 29, 2020
1 parent 4c4dc9b commit 475e5ed
Show file tree
Hide file tree
Showing 55 changed files with 4,487 additions and 0 deletions.
70 changes: 70 additions & 0 deletions qa/viewer-jfx/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.9'
}

repositories {
mavenCentral()
}

description 'ICEpdf qa framework application'

mainClassName = "org.icepdf.qa.viewer.Launcher"
applicationDefaultJvmArgs = ["-Xms64m", "-Xmx4096m"]

def sectionName = 'org/icepdf/qa/'

repositories {
mavenCentral()
jcenter()
}

jar {
archiveBaseName.set('icepdf-qa')
archiveAppendix.set("viewer")
archiveVersion.set("${VERSION}")
archiveClassifier.set("${RELEASE_TYPE}")

doFirst {
manifest {
attributes ('Created-By': System.getProperty('java.version') + ' (' + System.getProperty('java.vendor') + ')')
// executable jar
attributes("Main-Class": 'org.icepdf.qa.viewer.Launcher')
if (!configurations.runtimeClasspath.isEmpty()) {
attributes('Class-Path':
configurations.runtimeClasspath.files.collect{it.name}.join(' '))
}
}
}

manifest {
// section names attributes
attributes("Implementation-Title": "${archiveBaseName.get() + '-' + archiveAppendix.get()}", "${sectionName}")
attributes("Implementation-Version": "${VERSION + (RELEASE_TYPE?.trim()? '-' + RELEASE_TYPE:'')}", "${sectionName}")
attributes("Implementation-Vendor": "${COMPANY}", "${sectionName}")
}
}

javafx {
version = "11.0.2"
modules = [ 'javafx.base', 'javafx.controls', 'javafx.graphics' ]
}


dependencies {
// jackson json.
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.6'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.8.6'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.6'
implementation group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
implementation group: 'junit', name: 'junit', version: '4.12'
// signature validation.
implementation 'org.bouncycastle:bcprov-jdk15on:' + "${BOUNCY_VERSION}"
implementation 'org.bouncycastle:bcprov-ext-jdk15on:' + "${BOUNCY_VERSION}"
implementation 'org.bouncycastle:bcpkix-jdk15on:' + "${BOUNCY_VERSION}"
// tiff, jpeg2000 and jbig decoding
implementation 'com.twelvemonkeys.imageio:imageio-tiff:' + "${MONKEY_VERSION}"
implementation 'com.github.jai-imageio:jai-imageio-jpeg2000:' + "${JAI_VERSION}"
implementation 'org.apache.pdfbox:jbig2-imageio:' + "${JBIG2_VERSION}"

}
18 changes: 18 additions & 0 deletions qa/viewer-jfx/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ICEpdf QA

This is an optional capture/viewer utility for testing the render core for regressions. Capture can be taken for a
particular build and compared against another. Capture results are stored in `~/dev/pdf-qa/results/` but can be
configured via the `PreferencesController`.

## Building

The UI wrapper for the capture tool was written in JFX which adds a hurdle to building the whole library.
As a result if you find yourself in a situation were you need to do rendering core regression checking you'll need to
uncomment `'qa:viewer-jfx',` in the root settings.gradle config file. There currently isn't a maven build for this
application as it only appeals to a small group of users.

### Launch

`gradle --stacktrace :qa:viewer-jfx:run`

Head over to https://openjfx.io/index.html to install JFX for your version of java.
170 changes: 170 additions & 0 deletions qa/viewer-jfx/src/main/java/org/icepdf/qa/config/CaptureSet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
package org.icepdf.qa.config;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

import java.net.URLClassLoader;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

/**
* Capture set details, mainly keeps track of the content sets being used and some meta data.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
public class CaptureSet {

public enum Type {

capture {
public String toString() {
return "Capture";
}
},
metric {
public String toString() {
return "Metric";
}
},
textExtraction {
public String toString() {
return "Text Extraction";
}
}
}

private Path captureSetPath;

private String name;
private Type type;

private String version;
private String classPath;
private URLClassLoader classLoader;
private int capturePageCount;

private String jdkVersion;
private String systemProperties;

private List<String> contentSets;

private Path contentSetPath;

private boolean complete;

@JsonCreator
public CaptureSet(@JsonProperty("name") String name,
@JsonProperty("type") Type type) {
this.name = name;
this.type = type;
contentSets = new ArrayList<>();
}

public Type getType() {
return type;
}

public void setType(Type type) {
this.type = type;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getVersion() {
return version;
}

public void setVersion(String version) {
this.version = version;
}

public String getClassPath() {
return classPath;
}

public void setClassPath(String classPath) {
this.classPath = classPath;
}

public int getCapturePageCount() {
return capturePageCount;
}

public void setCapturePageCount(int capturePageCount) {
this.capturePageCount = capturePageCount;
}

public String getJdkVersion() {
return jdkVersion;
}

public void setJdkVersion(String jdkVersion) {
this.jdkVersion = jdkVersion;
}

public String getSystemProperties() {
return systemProperties;
}

public void setSystemProperties(String systemProperties) {
this.systemProperties = systemProperties;
}

public List<String> getContentSets() {
return contentSets;
}

public void setContentSets(List<String> contentSets) {
this.contentSets = contentSets;
}

public boolean isComplete() {
return complete;
}

public void setComplete(boolean complete) {
this.complete = complete;
}

@Override
public String toString() {
return name;
}

@Override
public boolean equals(Object obj) {
if (obj != null)
return this.getName().equals(((CaptureSet) obj).getName());
else {
return super.equals(obj);
}
}

@JsonIgnore
public Path getCaptureSetPath() {
return captureSetPath;
}

@JsonIgnore
public void setCaptureSetPath(Path captureSetPath) {
this.captureSetPath = captureSetPath;
}

@JsonIgnore
public URLClassLoader getClassLoader() {
return classLoader;
}

@JsonIgnore
public void setClassLoader(URLClassLoader classLoader) {
this.classLoader = classLoader;
}
}
Loading

0 comments on commit 475e5ed

Please sign in to comment.