feat(config) expose "fullscreen" property, closes #488 (#510)

* feat(config) expose "fullscreen" property

* fix(tauri) tests not compiling

* fix(tauri.js) increase timeout for app test
This commit is contained in:
Lucas Fernandes Nogueira
2020-03-12 13:42:38 -03:00
committed by GitHub
parent 5b46bacd46
commit 57cdf660d1
5 changed files with 16 additions and 4 deletions

View File

@@ -33,7 +33,11 @@ export default {
all: true
},
window: {
title: 'Tauri App'
title: 'Tauri App',
width: 800,
height: 600,
resizable: true,
fullscreen: false
},
security: {
csp: "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"

View File

@@ -6,7 +6,7 @@ const mockFixtureDir = path.resolve(__dirname, '../fixtures')
module.exports.fixtureDir = mockFixtureDir
module.exports.initJest = (mockFixture) => {
jest.setTimeout(240000)
jest.setTimeout(720000)
jest.mock('helpers/non-webpack-require', () => {
return path => {
const value = require('fs').readFileSync(path).toString()

View File

@@ -24,7 +24,7 @@ icon = [
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { version = "0.4", features = [ "all-api", "edge" ] }
tauri = { path = "../../..", features = [ "all-api", "edge" ] }
[target."cfg(windows)".build-dependencies]
winres = "0.1"

View File

@@ -191,12 +191,13 @@ fn build_webview(
let width = config.tauri.window.width;
let height = config.tauri.window.height;
let resizable = config.tauri.window.resizable;
let fullscreen = config.tauri.window.fullscreen;
let title = config.tauri.window.title.into_boxed_str();
let has_splashscreen = splashscreen_content.is_some();
let mut initialized_splashscreen = false;
let webview = builder()
let mut webview = builder()
.title(Box::leak(title))
.size(width, height)
.resizable(resizable)
@@ -251,6 +252,8 @@ fn build_webview(
})
.build()?;
webview.set_fullscreen(fullscreen);
if has_splashscreen {
// inject the tauri.js entry point
webview

View File

@@ -13,6 +13,8 @@ pub struct WindowConfig {
pub resizable: bool,
#[serde(default = "default_title")]
pub title: String,
#[serde(default)]
pub fullscreen: bool,
}
fn default_width() -> i32 {
@@ -37,6 +39,7 @@ fn default_window() -> WindowConfig {
height: default_height(),
resizable: default_resizable(),
title: default_title(),
fullscreen: false,
}
}
@@ -128,6 +131,7 @@ mod test {
height: 600,
resizable: true,
title: String::from("Tauri App"),
fullscreen: false,
},
embedded_server: EmbeddedServerConfig {
host: String::from("http://127.0.0.1"),
@@ -180,6 +184,7 @@ mod test {
height: 600,
resizable: true,
title: String::from("Tauri App"),
fullscreen: false,
},
embedded_server: EmbeddedServerConfig {
host: String::from("http://127.0.0.1"),