test: re-enable native module tests (#47805)
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
53c17ea4f5
commit
658d52ecf1
2 changed files with 0 additions and 48 deletions
|
@ -194,7 +194,6 @@ jobs:
|
|||
MOCHA_REPORTER: mocha-multi-reporters
|
||||
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
|
||||
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
|
||||
ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
|
||||
DISPLAY: ':99.0'
|
||||
NPM_CONFIG_MSVS_VERSION: '2022'
|
||||
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 { expect } from 'chai';
|
||||
|
@ -6713,52 +6712,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', () => {
|
||||
afterEach(closeAllWindows);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue