From 658d52ecf14357c694705f88a2782a2d8c520fb0 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 17 Jul 2025 21:52:20 +0200 Subject: [PATCH] test: re-enable native module tests (#47805) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- .../pipeline-segment-electron-test.yml | 1 - spec/api-browser-window-spec.ts | 47 ------------------- 2 files changed, 48 deletions(-) diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index ae2a19b30ae9..77010f1ea559 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -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: | diff --git a/spec/api-browser-window-spec.ts b/spec/api-browser-window-spec.ts index a23562c111b0..326f098f78f5 100755 --- a/spec/api-browser-window-spec.ts +++ b/spec/api-browser-window-spec.ts @@ -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);