Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
erp5
Commits
6e8a2d02
Commit
6e8a2d02
authored
Dec 14, 2012
by
Pere Cortes
Committed by
Sebastien Robin
Jan 31, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_safeimage: unit test fixed and func test added
parent
2e3d68b6
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
7770 additions
and
29 deletions
+7770
-29
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/ERP5SafeImage_view.xml
...teItem/portal_skins/erp5_safeimage/ERP5SafeImage_view.xml
+23
-11
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/SeleniumSafeImage_uploadFile.xml
...tal_skins/erp5_safeimage/SeleniumSafeImage_uploadFile.xml
+78
-0
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/Selenium_cleanUp.xml
...lateItem/portal_skins/erp5_safeimage/Selenium_cleanUp.xml
+28
-0
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/Selenium_uploadImage.xml
...Item/portal_skins/erp5_safeimage/Selenium_uploadImage.xml
+28
-0
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/img/image_test.jpg.xml
...teItem/portal_skins/erp5_safeimage/img/image_test.jpg.xml
+7455
-0
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/js/form.js.xml
...inTemplateItem/portal_skins/erp5_safeimage/js/form.js.xml
+5
-2
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/js/safeimage.js.xml
...plateItem/portal_skins/erp5_safeimage/js/safeimage.js.xml
+3
-4
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/js/template.js.xml
...mplateItem/portal_skins/erp5_safeimage/js/template.js.xml
+2
-3
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/user-extensions.js.xml
...teItem/portal_skins/erp5_safeimage/user-extensions.js.xml
+139
-0
bt5/erp5_safeimage/TestTemplateItem/testSafeImage.py
bt5/erp5_safeimage/TestTemplateItem/testSafeImage.py
+8
-8
bt5/erp5_safeimage/bt/revision
bt5/erp5_safeimage/bt/revision
+1
-1
No files found.
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/ERP5Safe
view_SafeImage
.xml
→
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/ERP5Safe
Image_view
.xml
View file @
6e8a2d02
...
@@ -76,16 +76,28 @@
...
@@ -76,16 +76,28 @@
</section>
\n
</section>
\n
</div>
\n
</div>
\n
</div>
\n
</div>
\n
<script
type=
"text/javascript"
src=
"js/template.js"
></script>
\n
<tal:block
tal:define=
"portal_url python:here.getPortalObject().absolute_url()"
>
\n
<script
type=
"text/javascript"
src=
"jquery/core/jquery.js"
></script>
\n
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
src=
"urlHandler.js"
></script>
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'js/template.js\')"
></script>
\n
<script
type=
"text/javascript"
src=
"ICanHaz.min.js"
></script>
\n
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
src=
"openlayers/OpenLayers.js"
></script>
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'jquery/core/jquery.js\')"
></script>
\n
<script
type=
"text/javascript"
src=
"js/CanvasImage.js"
></script>
\n
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
src=
"js/ERP5_OpenLayers.js"
></script>
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'urlHandler.js\')"
></script>
\n
<script
type=
"text/javascript"
src=
"js/form.js"
></script>
\n
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
src=
"js/safeimage.js"
></script>
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'ICanHaz.min.js\')"
></script>
\n
<script
type=
"text/javascript"
src=
"js/pixastic.js"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'openlayers/OpenLayers.js\')"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'js/CanvasImage.js\')"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'js/ERP5_OpenLayers.js\')"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'js/form.js\')"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'js/safeimage.js\')"
></script>
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src python: \'%s/%s\' % (portal_url,\'js/pixastic.js\')"
></script>
\n
</tal:block>
\n
</body>
\n
</body>
\n
</html>
</html>
...
@@ -101,7 +113,7 @@
...
@@ -101,7 +113,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Safe
view_SafeImage
</string>
</value>
<value>
<string>
ERP5Safe
Image_view
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<key>
<string>
output_encoding
</string>
</key>
...
...
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/SeleniumSafeImage_uploadFile.xml
0 → 100644
View file @
6e8a2d02
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
#from Products.ERP5.Document.TileImageTransformed import TileImageTransformed\n
#from cStringIO import StringIO\n
\n
\n
portal = context.getPortalObject()\n
\n
\n
data = portal.restrictedTraverse("portal_skins/erp5_safeimage/img/image_test.jpg")\n
\n
print data.data\n
\n
return printed\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SeleniumSafeImage_uploadFile
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/Selenium_cleanUp.xml
0 → 100644
View file @
6e8a2d02
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
cleanUp
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
ERP5SafeImage_Selenium
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Selenium_cleanUp
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Selenium_cleanUp
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/Selenium_uploadImage.xml
0 → 100644
View file @
6e8a2d02
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
uploadImage
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
ERP5SafeImage_Selenium
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Selenium_uploadImage
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Selenium_uploadImage
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/img/image_test.jpg.xml
0 → 100644
View file @
6e8a2d02
This source diff could not be displayed because it is too large. You can
view the blob
instead.
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/js/form.js.xml
View file @
6e8a2d02
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts5
4117138.4
</string>
</value>
<value>
<string>
ts5
5132689.11
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -101,6 +101,9 @@
...
@@ -101,6 +101,9 @@
\t\t\t\t$(function()
{\n
\t\t\t\t$(function()
{\n
\t\n
\t\n
\t\t\t
SafeImage.loadOpenLayerZoomedImage(zoomify_width,zoomify_height,
zoomify_url,data);\n
\t\t\t
SafeImage.loadOpenLayerZoomedImage(zoomify_width,zoomify_height,
zoomify_url,data);\n
if
(document.location.search
!=
""){\n
SafeImage.map.zoomTo(Number(document.location.search.split("")[6]));\n
}
\n
\t\t\t\t
});\n
\t\t\t\t
});\n
\t};\n
\t};\n
\n
\n
...
@@ -134,7 +137,7 @@ $("#main").form();\n
...
@@ -134,7 +137,7 @@ $("#main").form();\n
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
2900
</int>
</value>
<value>
<int>
3057
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/js/safeimage.js.xml
View file @
6e8a2d02
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts5
4116947.11
</string>
</value>
<value>
<string>
ts5
5133579.12
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
\n
\n
that.map = new OpenLayers.Map("map", options);\n
that.map = new OpenLayers.Map("map", options);\n
that.map.addLayer(that.zoomify);\n
that.map.addLayer(that.zoomify);\n
\n
that.map.setBaseLayer(that.zoomify);\n
that.map.setBaseLayer(that.zoomify);\n
that.map.zoomToMaxExtent();\n
that.map.zoomToMaxExtent();\n
};\n
};\n
...
@@ -58,7 +57,7 @@
...
@@ -58,7 +57,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
100
9
</int>
</value>
<value>
<int>
100
6
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/js/template.js.xml
View file @
6e8a2d02
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts54
117152.04
</string>
</value>
<value>
<string>
ts54
293364.05
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
document.write("
<div
id=
\'map\'
class=
\'smallmap\'
></div>
");\n
document.write("
<div
id=
\'map\'
class=
\'smallmap\'
></div>
");\n
document.write("
</article>
");\n
document.write("
</article>
");\n
document.write("
</script>
");\n
document.write("
</script>
");\n
document.domain = "localhost";\n
})();\n
})();\n
\n
\n
...
@@ -43,7 +42,7 @@
...
@@ -43,7 +42,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
3
50
</int>
</value>
<value>
<int>
3
17
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_safeimage/SkinTemplateItem/portal_skins/erp5_safeimage/user-extensions.js.xml
0 → 100644
View file @
6e8a2d02
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts54892065.66
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
user-extensions.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/x-javascript
</string>
</value>
</item>
<item>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/**\n
* Selenium extensions for the ERP5 project\n
*/\n
\n
/* pere */\n
\n
/**\n
* Checks the element referenced by `locator` is a float equals to `text`.\n
* Values are converted to float, to be format-independant (ie. 1 000 = 1000.0)\n
*/\n
Selenium.prototype.assertFloat = function(locator, text) {\n
var actualValueText = getText(this.page().findElement(locator));\n
var actualValue = parseFloat(actualValueText\n
.replace(/ /g, "").replace(/ /g, ""));\n
var expectedValue = parseFloat(text.replace(/ /g, "").replace(/ /g, ""));\n
\n
if (isNaN(actualValue)) {\n
Assert.fail("Actual value "+ actualValueText +\n
" cannot be parsed as float");\n
}\n
Assert.matches(expectedValue.toString(), actualValue.toString());\n
};\n
\n
\n
/**\n
* like assertFloat, but for the value of <input elements.\n
*/\n
Selenium.prototype.assertFloatValue = function(locator, text) {\n
var actualValueText = getInputValue(this.page().findElement(locator));\n
var actualValue = parseFloat(actualValueText\n
.replace(/ /g, "").replace(/ /g, ""));\n
var expectedValue = parseFloat(text.replace(/ /g, "").replace(/ /g, ""));\n
\n
if (isNaN(actualValue)) {\n
Assert.fail("Actual value "+ actualValueText +\n
" cannot be parsed as float");\n
}\n
Assert.matches(expectedValue.toString(), actualValue.toString());\n
};\n
\n
\n
/**\n
* Checks the portal status message.\n
*/\n
Selenium.prototype.assertPortalStatusMessage = function(text) {\n
var psm_locator = "//div[@id=\'transition_message\']";\n
var actualValue = getText(this.page().findElement(psm_locator));\n
Assert.matches(text, actualValue);\n
};\n
\n
Selenium.prototype.doType = function(locator, newText) {\n
if (typeof(netscape) != "undefined" && typeof(netscape.security.PrivilegeManager) != "undefined" ) {\n
// On old firefox versions, we enable privilege to upload file in javascript.\n
// The user needs to have signed.applets.codebase_principal_support set to true in about:config\n
// This is done in prefs.js generated by product/ERP5Type/tests/runFunctionalTest.py\n
// This approach no longer work in newer firefox versions https://developer.mozilla.org/en-US/docs/Bypassing_Security_Restrictions_and_Signing_Code\n
// Without this, tests dealing with file upload will fail\n
netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");\n
}\n
var element = this.page().findElement(locator);\n
this.page().replaceText(element, newText);\n
};\n
\n
/*\n
* Get the location of the current page. This function is missing in\n
* Selenium 0.8 or later.\n
*/\n
Selenium.prototype.getAbsoluteLocation = function() {\n
return this.page().location || this.browserbot.getCurrentWindow().location;\n
};\n
\n
Selenium.prototype.doPhantomRender = function(filename) {\n
if (window.page && window.page.render) {\n
page.render(filename);\n
}\n
};\n
\n
Selenium.prototype.doZoomIn = function() {\n
this.page().SafeImage.map.zoomTo(1);\n
};\n
\n
Selenium.prototype.doZoomOut = function() {\n
this.page().SafeImage.map.zoomTo(0);\n
};\n
\n
\n
Selenium.prototype.assertElementPositionRangeTop = function(locator, range){\n
var positionTop = parseFloat(this.getElementPositionTop(locator));\n
/* example of range 450..455 */\n
var rangeList = range.split("..");\n
var minimumPositionTop = parseFloat(rangeList[0]);\n
var maximumPositionTop = parseFloat(rangeList[1]);\n
if (positionTop < minimumPositionTop || positionTop >
maximumPositionTop ){\n
Assert.fail(positionTop + " is not between " + minimumPositionTop + " and " + maximumPositionTop);\n
};\n
};
]]>
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
3622
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_safeimage/TestTemplateItem/testSafeImage.py
View file @
6e8a2d02
...
@@ -33,7 +33,7 @@ class TestSafeImage(ERP5TypeTestCase):
...
@@ -33,7 +33,7 @@ class TestSafeImage(ERP5TypeTestCase):
def
getBusinessTemplateList
(
self
):
def
getBusinessTemplateList
(
self
):
return
(
'erp5_base'
,
return
(
'erp5_base'
,
'erp5_dms'
,
'erp5_dms'
,
'erp5_safeimage'
,
'erp5_safeimage'
)
)
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
...
...
bt5/erp5_safeimage/bt/revision
View file @
6e8a2d02
5
6
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment