diff --git a/scripts/app_preferences.lua b/scripts/app_preferences.lua new file mode 100644 index 000000000..24df608ca --- /dev/null +++ b/scripts/app_preferences.lua @@ -0,0 +1,38 @@ +-- Copyright (C) 2019 Igara Studio S.A. +-- +-- This file is released under the terms of the MIT license. +-- Read LICENSE.txt for more information. + +-- Global preferences +do + assert(app.preferences.general.language == "en") + assert(app.preferences.general.screen_scale == 2) + assert(app.preferences.general.ui_scale == 1) +end + +-- Preferences for tools +do + local t = app.preferences.tool('pencil') + assert(t.opacity == 255) + assert(t.tolerance == 0) + assert(t.contiguous == true) + assert(t.brush.type == BrushType.CIRCLE) + assert(t.brush.size == 1) + t.brush.size = 2 + assert(t.brush.size == 2) + + -- Getting the tool again will give us the default configuration + -- again in batch mode + t = app.preferences.tool('pencil') + assert(t.brush.size == 1) +end + +-- Preferences for documents +do + local s = Sprite(32, 32) + local p = app.preferences.document(s) + assert(p.grid.bounds == Rectangle(0, 0, 16, 16)) + assert(p.grid.color == Color(0, 0, 255)) + p.grid.color = Color(255, 0, 0) + assert(p.grid.color == Color(255, 0, 0)) +end