Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const FILE_FILTERS = [
{ name: 'All Files', extensions: [ '*' ] },
]

const TROUBLESHOOTING_URL = 'https://github.com/lacymorrow/crossover/wiki/Troubleshooting'
const COMPATIBILITY_URL = 'https://github.com/lacymorrow/crossover/wiki/Compatibility'

const config = {
APP_ASPECT_RATIO,
APP_BACKGROUND_OPACITY,
Expand All @@ -48,6 +51,8 @@ const config = {
MAX_SHADOW_WINDOWS,
SETTINGS_WINDOW_DEVTOOLS,
SHADOW_WINDOW_OFFSET,
TROUBLESHOOTING_URL,
COMPATIBILITY_URL,

SUPPORTED_IMAGE_FILE_TYPES,
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/ipc.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ const init = () => {

} )

ipcMain.on( 'set_preference', arg => {
ipcMain.on( 'set_preference', ( _event, arg ) => {

if ( arg.key && arg.value ) {
if ( arg && arg.key && arg.value !== undefined ) {

preferences.value( arg.key, arg.value )

Expand Down
12 changes: 8 additions & 4 deletions src/main/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ const appEvents = () => {
// CrossOver only renders local files and needs no browser permissions.
// Deny all permission requests (geolocation, notifications, camera, etc.)
// to prevent unexpected OS prompts, particularly on Windows. (#471)
session.defaultSession.setPermissionRequestHandler( ( _webContents, _permission, callback ) => {
app.whenReady().then( () => {

callback( false )
session.defaultSession.setPermissionRequestHandler( ( _webContents, _permission, callback ) => {

} )
callback( false )

} )

session.defaultSession.setPermissionCheckHandler( () => false )
session.defaultSession.setPermissionCheckHandler( () => false )

} )

app.on( 'activate', async () => {

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/styles/dist/index.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 30 additions & 39 deletions test/ipc.spec.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
// Not tested:
// - keybinds
// - drag File
// - drag window
// - native close button
// - Notification
// - Sounds

// Test:
// - Main
// - 2nd instance
// - will-quit remove shortcuts
// - exit code
// - Menu
// - Dock
// - Always visible
// - Features
// - Functions
// - Create child window
// - Settings
// - IOHooks
// - Accelerators
// - moveX
// - Lock
// - duplicate
// - center
// - reset
// - changeDisplay
// - hide
// - IPC
// - reset_preferences
// - close_window
// - save_custom_image
// - get_crosshairs
// - save_crosshair
// - update_and_restart
// - quit

const { expect, test } = require( '@playwright/test' )
const { startApp, closeApp, wait, focusedMinimizedVisible, getBounds, delays, CHOOSER_WINDOW, SETTINGS_WINDOW } = require( './helpers.js' )
const { productName } = require( '../package.json' )
Expand Down Expand Up @@ -131,6 +93,34 @@ test( 'Validate open_settings + focus', async () => {

test( 'Validate set_preference + reset_preference', async () => {

// Test set_preference
await electronApp.evaluate( async app => app.ipcMain.emit( 'set_preference', {}, { key: 'crosshair.opacity', value: 50 } ) )
await wait( delays.short )

const opacity = await electronApp.evaluate( async app => {

const preferences = process.mainModule.require( './src/main/preferences.js' ).init()

return preferences.value( 'crosshair.opacity' )

} )
expect( opacity ).toBe( 50 )

// Test reset_preferences
await electronApp.evaluate( async app => app.ipcMain.emit( 'reset_preferences', {} ) )
await wait( delays.short )

// Verify reset
const newOpacity = await electronApp.evaluate( async app => {

const preferences = process.mainModule.require( './src/main/preferences.js' ).init()

return preferences.value( 'crosshair.opacity' )

} )
// Verify default opacity value is restored to 80
expect( newOpacity ).toBe( 80 )

} )

test( 'Validate quit', async () => {
Expand All @@ -139,10 +129,11 @@ test( 'Validate quit', async () => {

// quit app
await electronApp.evaluate( async app => app.ipcMain.emit( 'quit' ) )
await wait( delays.medium )

try {

console.log( 'This should throw an error!', await mainPage.title() )
await mainPage.title()

} catch {

Expand Down