test: re-enable native module tests (#47804)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
ea4d43d59e
commit
8c974c022a
2 changed files with 0 additions and 48 deletions
|
@ -194,7 +194,6 @@ jobs:
|
||||||
MOCHA_REPORTER: mocha-multi-reporters
|
MOCHA_REPORTER: mocha-multi-reporters
|
||||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
|
||||||
DISPLAY: ':99.0'
|
DISPLAY: ':99.0'
|
||||||
NPM_CONFIG_MSVS_VERSION: '2022'
|
NPM_CONFIG_MSVS_VERSION: '2022'
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { nativeImage } from 'electron';
|
|
||||||
import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main';
|
import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main';
|
||||||
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
@ -6676,52 +6675,6 @@ describe('BrowserWindow module', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('offscreen rendering image', () => {
|
|
||||||
afterEach(closeAllWindows);
|
|
||||||
|
|
||||||
const imagePath = path.join(fixtures, 'assets', 'osr.png');
|
|
||||||
const targetImage = nativeImage.createFromPath(imagePath);
|
|
||||||
const nativeModulesEnabled = !process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS;
|
|
||||||
ifit(nativeModulesEnabled && ['win32'].includes(process.platform))('use shared texture, hardware acceleration enabled', (done) => {
|
|
||||||
const { ExtractPixels, InitializeGpu } = require('@electron-ci/osr-gpu');
|
|
||||||
|
|
||||||
try {
|
|
||||||
InitializeGpu();
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Failed to initialize GPU, this spec needs a valid GPU device. Skipping...');
|
|
||||||
console.error(e);
|
|
||||||
done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const w = new BrowserWindow({
|
|
||||||
show: false,
|
|
||||||
webPreferences: {
|
|
||||||
offscreen: {
|
|
||||||
useSharedTexture: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
transparent: true,
|
|
||||||
frame: false,
|
|
||||||
width: 128,
|
|
||||||
height: 128
|
|
||||||
});
|
|
||||||
|
|
||||||
w.webContents.once('paint', async (e, dirtyRect) => {
|
|
||||||
try {
|
|
||||||
expect(e.texture).to.be.not.null();
|
|
||||||
const pixels = ExtractPixels(e.texture!.textureInfo);
|
|
||||||
const img = nativeImage.createFromBitmap(pixels, { width: dirtyRect.width, height: dirtyRect.height, scaleFactor: 1 });
|
|
||||||
expect(img.toBitmap().equals(targetImage.toBitmap())).to.equal(true);
|
|
||||||
done();
|
|
||||||
} catch (e) {
|
|
||||||
done(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
w.loadFile(imagePath);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('"transparent" option', () => {
|
describe('"transparent" option', () => {
|
||||||
afterEach(closeAllWindows);
|
afterEach(closeAllWindows);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue