Skip to content

Commit

Permalink
test: fix wrong coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
WoodNeck committed Nov 9, 2020
1 parent f48be9b commit 8111462
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module.exports = config => {
dir: "./coverage"
};
karmaConfig.webpack.module.rules.unshift({
test: /\.js$/,
test: /\.ts$/,
exclude: /(node_modules|test)/,
loader: "istanbul-instrumenter-loader"
});
Expand Down
10 changes: 5 additions & 5 deletions src/PanoImageRenderer/PanoImageRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,11 @@ class PanoImageRenderer extends Component<{
}

public hasRenderingContext() {
if (!(this.context && !this.context.isContextLost())) {
return false;
} else if (
this.context &&
!this.context.getProgramParameter(this.shaderProgram!, this.context.LINK_STATUS)) {
const ctx = this.context;
if (
!ctx
|| ctx.isContextLost()
|| !ctx.getProgramParameter(this.shaderProgram!, ctx.LINK_STATUS)) {
return false;
}
return true;
Expand Down
15 changes: 9 additions & 6 deletions test/unit/PanoImageRenderer/SphereRenderer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ describe("SphereRenderer", () => {
const deviceRatio = window.devicePixelRatio;
const suffix = `_${deviceRatio}x.png`;

beforeEach(() => {
target = sandbox();

target.style.width = "2000px";
target.style.height = "2000px";
});
before(() => {
cleanup();
});

afterEach(() => {
cleanup();
Expand All @@ -56,6 +53,9 @@ describe("SphereRenderer", () => {
/**
* Given / When
*/
target = sandbox();
target.style.width = "2000px";
target.style.height = "2000px";
const viewer = createPanoViewerForRenderingTest(target, {
image: "./images/PanoViewer/Stereoscopic/stereoscopic1.png",
projectionType: PanoViewer.PROJECTION_TYPE.STEREOSCOPIC_EQUI,
Expand All @@ -77,6 +77,9 @@ describe("SphereRenderer", () => {
/**
* Given / When
*/
target = sandbox();
target.style.width = "3000px";
target.style.height = "3000px";
const viewer = createPanoViewerForRenderingTest(target, {
image: "./images/PanoViewer/Stereoscopic/stereoscopic2.png",
projectionType: PanoViewer.PROJECTION_TYPE.STEREOSCOPIC_EQUI,
Expand Down

0 comments on commit 8111462

Please sign in to comment.