Skip to content

Commit

Permalink
Merge pull request #14 from strawberry-vis/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
xiaoiver authored Sep 18, 2023
2 parents b6677c6 + 7f84a17 commit 47e6d55
Show file tree
Hide file tree
Showing 35 changed files with 2,112 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ es
lib
dist
node_modules
test
examples
rust
__tests__
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @strawberry-vis/g-device-api

## 1.0.3

### Patch Changes

- 6143192: Generate mipmap for 3D texture.

## 1.0.2

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions __tests__/integration/primitive-topology-points.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import _gl from 'gl';
import { getWebGLDeviceContributionAndCanvas } from '../utils';
import { render } from '../../test/demos/primitive-topology-points';
import { render } from '../../examples/demos/primitive-topology-points';
import '../useSnapshotMatchers';

describe('Primitive topology triangles', () => {
it('should render triangles correctly.', async () => {
describe('Primitive Topology Points', () => {
it('should render correctly.', async () => {
const [webGLDeviceContribution, $canvas] =
getWebGLDeviceContributionAndCanvas();

Expand Down
6 changes: 3 additions & 3 deletions __tests__/integration/primitive-topology-triangles.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import _gl from 'gl';
import { getWebGLDeviceContributionAndCanvas } from '../utils';
import { render } from '../../test/demos/primitive-topology-triangles';
import { render } from '../../examples/demos/primitive-topology-triangles';
import '../useSnapshotMatchers';

describe('Primitive topology triangles', () => {
it('should render triangles correctly.', async () => {
describe('Primitive Topology Triangles', () => {
it('should render correctly.', async () => {
const [webGLDeviceContribution, $canvas] =
getWebGLDeviceContributionAndCanvas();

Expand Down
26 changes: 26 additions & 0 deletions __tests__/integration/rotating-cube.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import _gl from 'gl';
import { getWebGLDeviceContributionAndCanvas } from '../utils';
import { render } from '../../examples/demos/rotating-cube';
import '../useSnapshotMatchers';

describe('Rotating Cube', () => {
it('should render correctly.', async () => {
const [webGLDeviceContribution, $canvas] =
getWebGLDeviceContributionAndCanvas();

const disposeCallback = await render(
webGLDeviceContribution,
$canvas,
false,
);

const dir = `${__dirname}/snapshots`;

expect($canvas.getContext('webgl1')).toMatchWebGLSnapshot(
dir,
'rotating-cube',
);

disposeCallback();
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/snapshots/textured-cube.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added __tests__/integration/texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions __tests__/integration/textured-cube.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import _gl from 'gl';
import getPixels from 'get-pixels';
import { getWebGLDeviceContributionAndCanvas } from '../utils';
import { render } from '../../examples/demos/textured-cube';
import '../useSnapshotMatchers';

describe('Textured Cube', () => {
it('should render correctly.', async () => {
// Load local image instead of fetching remote URL.
// @see https://github.com/stackgl/headless-gl/pull/53/files#diff-55563b6c0b90b80aed19c83df1c51e80fd45d2fbdad6cc047ee86e98f65da3e9R83
const src = await new Promise((resolve, reject) => {
getPixels(__dirname + '/texture.png', function (err, image) {
if (err) {
reject('Bad image path');
} else {
image.width = image.shape[0];
image.height = image.shape[1];
resolve(image);
}
});
});

const [webGLDeviceContribution, $canvas] =
getWebGLDeviceContributionAndCanvas();

const disposeCallback = await render(
webGLDeviceContribution,
$canvas,
false,
// @ts-ignore
src,
);

const dir = `${__dirname}/snapshots`;

expect($canvas.getContext('webgl1')).toMatchWebGLSnapshot(
dir,
'textured-cube',
);

disposeCallback();
});
});
Loading

0 comments on commit 47e6d55

Please sign in to comment.