Merge pull request #6455 from electron/use-current-content-constraints
Initialize new size constraints to current constraints
This commit is contained in:
commit
606931d737
2 changed files with 16 additions and 1 deletions
|
@ -209,7 +209,7 @@ gfx::Size NativeWindow::GetContentSize() {
|
|||
|
||||
void NativeWindow::SetSizeConstraints(
|
||||
const extensions::SizeConstraints& window_constraints) {
|
||||
extensions::SizeConstraints content_constraints;
|
||||
extensions::SizeConstraints content_constraints(GetContentSizeConstraints());
|
||||
if (window_constraints.HasMaximumSize())
|
||||
content_constraints.set_maximum_size(
|
||||
WindowSizeToContentSize(window_constraints.GetMaximumSize()));
|
||||
|
|
|
@ -287,6 +287,21 @@ describe('browser-window module', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.setMinimum/MaximumSize(width, height)', function () {
|
||||
it('sets the maximum and minimum size of the window', function () {
|
||||
assert.deepEqual(w.getMinimumSize(), [0, 0])
|
||||
assert.deepEqual(w.getMaximumSize(), [0, 0])
|
||||
|
||||
w.setMinimumSize(100, 100)
|
||||
assert.deepEqual(w.getMinimumSize(), [100, 100])
|
||||
assert.deepEqual(w.getMaximumSize(), [0, 0])
|
||||
|
||||
w.setMaximumSize(900, 600)
|
||||
assert.deepEqual(w.getMinimumSize(), [100, 100])
|
||||
assert.deepEqual(w.getMaximumSize(), [900, 600])
|
||||
})
|
||||
})
|
||||
|
||||
describe('BrowserWindow.setAspectRatio(ratio)', function () {
|
||||
it('resets the behaviour when passing in 0', function (done) {
|
||||
var size = [300, 400]
|
||||
|
|
Loading…
Reference in a new issue