Revision: 2efd0a5edf7d
Branch:   default
Author:   Pekka Klärck
Date:     Wed Sep 12 07:08:08 2012
Log:      Screenshot: Placefolders for IronPython support.

Update issue 1225
Status: Started
Modified library so that adding actual code for taking screenshot on .NET is easy.
http://code.google.com/p/robotframework/source/detail?r=2efd0a5edf7d

Modified:
 /src/robot/libraries/Screenshot.py

=======================================
--- /src/robot/libraries/Screenshot.py  Tue Mar 20 05:47:41 2012
+++ /src/robot/libraries/Screenshot.py  Wed Sep 12 07:08:08 2012
@@ -18,6 +18,8 @@
     from java.awt import Toolkit, Robot, Rectangle
     from javax.imageio import ImageIO
     from java.io import File
+elif sys.platform == 'cli':
+    pass  # IronPython imports here
 else:
     try:
         import wx
@@ -39,14 +41,8 @@


 class Screenshot(object):
-
"""A test library for taking screenshots and embedding them into log files.

-    *Using with Jython*
-
-    On Jython this library uses Java AWT APIs. They are always available
-    and thus no external modules are needed.
-
     *Using with Python*

     On Python you need to have one of the following modules installed to be
@@ -61,6 +57,18 @@

     Python support was added in Robot Framework 2.5.5.

+    *Using with Jython*
+
+    On Jython this library uses Java AWT APIs. They are always available
+    and thus no external modules are needed.
+
+    *Using with IronPython*
+
+    On IronPython this library uses .NET APIs. They are always available
+    and thus no external modules are needed.
+
+    IronPython support was added in Robot Framework 2.7.5.
+
     *Where screenshots are saved*

By default screenshots are saved into the same directory where the Robot
@@ -257,6 +265,8 @@
     def _get_screenshot_taker(self, module_name):
         if sys.platform.startswith('java'):
             return self._java_screenshot
+        if sys.platform == 'cli':
+            return self._cli_screenshot
         if module_name:
             method_name = '_%s_screenshot' % module_name.lower()
             if hasattr(self, method_name):
@@ -277,6 +287,9 @@
         image = Robot().createScreenCapture(rectangle)
         ImageIO.write(image, 'jpg', File(path))

+    def _cli_screenshot(self, path):
+        raise NotImplementedError
+
     def _wx_screenshot(self, path):
         context = wx.ScreenDC()
         width, height = context.GetSize()

Reply via email to