-
-
Save kevinlinv/2de60478ffec6a2f18f1ec0fc6f5add9 to your computer and use it in GitHub Desktop.
BrowserView.setBackgroundColor regression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<h1>Expecting the background of the view to be blue</h1> | |
<script src="./renderer.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modules to control application life and create native browser window | |
const {app, BrowserWindow, BrowserView} = require('electron') | |
app.whenReady().then(() => { | |
const mainWindow = new BrowserWindow() | |
mainWindow.setBackgroundColor('#000') | |
const view = new BrowserView() | |
view.webContents.loadFile('index.html'); | |
// | |
// Test Case 1 - expected the background of the content to be #1224fa (blue) - matches the view background | |
// | |
// Test Case 2 - comment the setBackgroundColor - expected the background transparent and can see the window's backround color (black) | |
// | |
view.setBackgroundColor('#1224fa'); | |
const { width, height } = mainWindow.getContentBounds(); | |
mainWindow.addBrowserView(view); | |
view.setBounds({ x: 0, y: 0, width, height }) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "11 - view set background color bug", | |
"productName": "11 - view set background color bug", | |
"description": "My Electron application description", | |
"keywords": [], | |
"main": "./main.js", | |
"version": "1.0.0", | |
"author": "kevin", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"electron": "14.0.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Empty */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment