Merge pull request #6455 from electron/use-current-content-constraints

Initialize new size constraints to current constraints
This commit is contained in:
Cheng Zhao 2016-07-13 10:14:33 +09:00 committed by GitHub
commit 606931d737
2 changed files with 16 additions and 1 deletions

View file

@ -209,7 +209,7 @@ gfx::Size NativeWindow::GetContentSize() {
void NativeWindow::SetSizeConstraints( void NativeWindow::SetSizeConstraints(
const extensions::SizeConstraints& window_constraints) { const extensions::SizeConstraints& window_constraints) {
extensions::SizeConstraints content_constraints; extensions::SizeConstraints content_constraints(GetContentSizeConstraints());
if (window_constraints.HasMaximumSize()) if (window_constraints.HasMaximumSize())
content_constraints.set_maximum_size( content_constraints.set_maximum_size(
WindowSizeToContentSize(window_constraints.GetMaximumSize())); WindowSizeToContentSize(window_constraints.GetMaximumSize()));

View file

@ -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 () { describe('BrowserWindow.setAspectRatio(ratio)', function () {
it('resets the behaviour when passing in 0', function (done) { it('resets the behaviour when passing in 0', function (done) {
var size = [300, 400] var size = [300, 400]