mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
Add app.transaction() test
This commit is contained in:
parent
7ed438a855
commit
5ef31360f7
40
scripts/app_transaction.js
Normal file
40
scripts/app_transaction.js
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
|
||||
var s = new Sprite(16, 32)
|
||||
console.assert(s.width == 16)
|
||||
console.assert(s.height == 32)
|
||||
|
||||
s.width = 20
|
||||
console.assert(s.width == 20)
|
||||
console.assert(s.height == 32)
|
||||
|
||||
s.height = 40
|
||||
console.assert(s.width == 20)
|
||||
console.assert(s.height == 40)
|
||||
|
||||
app.undo()
|
||||
console.assert(s.width == 20)
|
||||
console.assert(s.height == 32)
|
||||
|
||||
app.undo()
|
||||
console.assert(s.width == 16)
|
||||
console.assert(s.height == 32)
|
||||
|
||||
app.transaction(
|
||||
function() {
|
||||
s.width = 20
|
||||
s.height = 40
|
||||
})
|
||||
console.assert(s.width == 20)
|
||||
console.assert(s.height == 40)
|
||||
|
||||
app.undo()
|
||||
console.assert(s.width == 16)
|
||||
console.assert(s.height == 32)
|
||||
|
||||
app.redo()
|
||||
console.assert(s.width == 20)
|
||||
console.assert(s.height == 40)
|
Loading…
Reference in New Issue
Block a user