Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add manual test for nw.Window API #6919

Open
wants to merge 1 commit into
base: nw35
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion test/manual/window/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<script>
var gui = nw;
var win;

gui.Window.open('popup.html', {
x: 100, y: 100, width: 200, height: 300
}, function(w) { win = w; });
Expand Down Expand Up @@ -39,7 +40,8 @@
if (win != null)
win.close(true);
this.close(true);
});
});


gui.Window.get().show();
</script>
Expand All @@ -51,6 +53,11 @@
<br/>
<button onclick="win.hide()">Hide</button>
<br/>
<button onclick="win.reloadDev()">reloadDev</button>
<br/>
<button onclick="win.setPosition('center')">setPosition(center)</button>
<!--button onclick="win.setPosition('mouse')">mouse</button>-->
<br/>
<button onclick="win.maximize()">Maximize</button>
<br/>
<button onclick="win.unmaximize()">Unmaximize</button>
Expand All @@ -63,12 +70,16 @@
<br/>
<button onclick="win.leaveFullscreen()">LeaveFullscreen</button>
<br/>
<button onclick="win.toggleFullscreen()">toggleFullscreen</button>
<br/>
<button onclick="win.close()">Close</button>
<br/>
<button onclick="win.close(true)">Force Close</button>
<br/>
<button onclick="win.showDevTools()">Open DevTools</button>
<br/>
<button onclick="win.closeDevTools()">Close DevTools</button>
<br/>
<button onclick="win.setMinimumSize(100, 200)">setMinimumSize(100, 200)</button>
<br/>
<button onclick="win.setMaximumSize(200, 400)">setMaximumSize(200, 400)</button>
Expand All @@ -84,6 +95,28 @@
<button onclick="win.setResizable(true)">setResizable(true)</button>
<button onclick="win.setResizable(false)">(false)</button>
<br/>
<!--<button onclick="win.setShadow(true)">setShadow (MAC)(true)</button>
<button onclick="win.setShadow(false)">(false)</button>
<br/>-->
<button onclick="win.setVisibleOnAllWorkspaces(true)">setVisibleOnAllWorkspaces(MAC,LINUX)(true)</button>
<button onclick="win.setVisibleOnAllWorkspaces(false)">(false)</button>
<br/>
<button onclick="win.setShowInTaskbar(true)">setShowInTaskbar (true)</button>
<button onclick="win.setShowInTaskbar(false)">(false)</button>
<br/>
<button onclick="win.requestAttention(true)">requestAttention (true)</button>
<button onclick="win.requestAttention(false)">(false)</button>
<br/>
<button onclick="win.requestAttention(10)">requestAttention (10s)</button>
<br/>
<button onclick="win.enterKioskMode()">enterKioskMode</button>
<br/>
<button onclick="win.leaveKioskMode()">leaveKioskMode</button>
<br/>
<button onclick="win.toggleKioskMode()">toggleKioskMode</button>
<br/>
<button onclick="win.print({})">print</button>
<br/>
<p>Focus another application within 2sec, popup window should on top.</p>
<button onclick="setTimeout(function(){win.setAlwaysOnTop(true);},2000)">setAlwaysOnTop(true)</button>
<button onclick="win.setAlwaysOnTop(false)">(false)</button>
Expand All @@ -94,7 +127,12 @@
<br/>
<button onclick="takeSnapshot()">takeSnapshot</button>
<br/>
<button onclick="win.removeAllListeners()">removeAllListeners</button>
<br/>
Reload the window and do all tests again.
<br/>
<button onclick="win.reload()">Reload</button>
<br/>
<button onclick="win.reloadIgnoringCache()">Reload ignoring cache</button>
</body>
</html>
13 changes: 13 additions & 0 deletions test/manual/window/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
var enable = false;
var gui = require('nw.gui');
var win = gui.Window.get();

var menu = new nw.Menu({ type: 'menubar' });
var submenu = new nw.Menu();
submenu.append(new nw.MenuItem({ label: 'Item A' }));
submenu.append(new nw.MenuItem({ label: 'Item B' }));
menu.append(new nw.MenuItem({
label: 'First Menu',
submenu: submenu
}));
win.menu = menu;

win.on('close', function() {
if (enable)
this.close(true);
Expand Down Expand Up @@ -72,6 +83,8 @@
<button onclick="javascript:enable = true;">Enable to be closed</button>
<br/>
<button onclick="win.leaveFullscreen()">Leave fullscreen</button>
<br/>
<button onclick="win.leaveKioskMode()">Leave KioskMode</button>

<div style="margin-top:10px;border-top: 1px solid #000;">
<img id="image" width="400" />
Expand Down