]> khamidou — GitHub mirrors - electron.git/commitdiff
Add spec for BrowserWindow.capturePage.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 22 Nov 2013 06:42:39 +0000 (14:42 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 22 Nov 2013 06:42:39 +0000 (14:42 +0800)
spec/api/window.coffee

index ebaf69a422f69458b8f83e88d6266061e0117bb9..66de175da971cddce3c4a7729e22f33c842d9966 100644 (file)
@@ -75,6 +75,13 @@ describe 'window module', ->
       assert.equal w.isVisible(), false
       w.close()
 
+  describe 'BrowserWindow.capturePage(rect, callback)', ->
+    it 'calls the callback with a Buffer', ->
+      w = new BrowserWindow(show: false)
+      w.capturePage {x: 0, y: 0, width: 100, height: 100}, (image) ->
+        assert.equal image.constructor.name, 'SlowBuffer'
+        w.close()
+
   describe 'beforeunload handler', ->
     it 'returning true would not prevent close', (done) ->
       w = new BrowserWindow(show: false)