forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Dialog.bounds doesn't work as expected (fix aseprite#3898)
Prior to this fix, the 'Dialog:show()' function overrode bounds when they were defined before the 'show' command.
- Loading branch information
1 parent
53f0cd6
commit 1e6bbe0
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- Copyright (C) 2023 Igara Studio S.A. | ||
-- | ||
-- This file is released under the terms of the MIT license. | ||
-- Read LICENSE.txt for more information. | ||
|
||
if app.isUIAvailable then | ||
dofile('./test_utils.lua') | ||
|
||
-- Test dialog bounds | ||
do | ||
local dlg = Dialog("Bounds test") | ||
local screenSize = Size(app.window.width, app.window.height) | ||
local bounds = dlg.bounds | ||
assert(bounds.x == (math.floor(screenSize.width / 2) - math.floor(bounds.width / 2))) | ||
assert(bounds.y == (math.floor(screenSize.height / 2) - math.floor(bounds.height / 2))) | ||
local bounds2 = bounds | ||
dlg:show { wait=false } | ||
bounds = dlg.bounds | ||
assert(bounds == bounds2) | ||
print(bounds) | ||
dlg:close() | ||
end | ||
|
||
do | ||
local rect = Rectangle(10, 20, 200, 50) | ||
local dlg2 = Dialog("Bounds test 2") | ||
dlg2.bounds = rect | ||
assert(dlg2.bounds == rect) | ||
dlg2:show { wait=false } | ||
assert(dlg2.bounds == rect) | ||
dlg2:close() | ||
end | ||
end |