forked from openlp/openlp
Modified some resources and added test
This commit is contained in:
parent
7db45b7ce6
commit
ec19cc5f07
@ -119,7 +119,7 @@ def str_to_bool(string_value):
|
||||
return str(string_value).strip().lower() in ('true', 'yes', 'y')
|
||||
|
||||
|
||||
def build_icon(icon, size=None):
|
||||
def build_icon(icon):
|
||||
"""
|
||||
Build a QIcon instance from an existing QIcon, a resource location, or a physical file location. If the icon is a
|
||||
QIcon instance, that icon is simply returned. If not, it builds a QIcon instance from the resource or file name.
|
||||
@ -127,22 +127,17 @@ def build_icon(icon, size=None):
|
||||
:param icon:
|
||||
The icon to build. This can be a QIcon, a resource string in the form ``:/resource/file.png``, or a file
|
||||
location like ``/path/to/file.png``. However, the **recommended** way is to specify a resource string.
|
||||
:param size:
|
||||
The size of the icon to generate
|
||||
:return: The build icon.
|
||||
"""
|
||||
if isinstance(icon, QtGui.QIcon):
|
||||
return icon
|
||||
pix_map = None
|
||||
button_icon = QtGui.QIcon()
|
||||
if isinstance(icon, str):
|
||||
if icon.startswith(':/'):
|
||||
pix_map = QtGui.QPixmap(icon)
|
||||
else:
|
||||
pix_map = QtGui.QPixmap.fromImage(QtGui.QImage(icon))
|
||||
elif isinstance(icon, QtGui.QImage):
|
||||
pix_map = QtGui.QPixmap.fromImage(icon)
|
||||
if size:
|
||||
pix_map = pix_map.scaled(size, size, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
if pix_map:
|
||||
button_icon.addPixmap(pix_map, QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
return button_icon
|
||||
|
||||
|
@ -89,7 +89,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties):
|
||||
# add the tab to get it to display in the correct part of the screen
|
||||
self.stacked_layout.addWidget(tab_widget)
|
||||
if is_visible:
|
||||
list_item = QtWidgets.QListWidgetItem(build_icon(tab_widget.icon_path, 16), tab_widget.tab_title_visible)
|
||||
list_item = QtWidgets.QListWidgetItem(build_icon(tab_widget.icon_path), tab_widget.tab_title_visible)
|
||||
list_item.setData(QtCore.Qt.UserRole, tab_widget.tab_title)
|
||||
self.setting_list_widget.addItem(list_item)
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
@ -8,263 +6,80 @@
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="467.39178"
|
||||
height="467.39178"
|
||||
id="svg5740"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.47 r22583"
|
||||
style="display:inline"
|
||||
version="1.0"
|
||||
sodipodi:docname="openlp-logo.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
inkscape:export-filename="/home/raoul/openlp-logo-0.2.png"
|
||||
inkscape:export-xdpi="91.860847"
|
||||
inkscape:export-ydpi="91.860847"
|
||||
style="display:inline">
|
||||
id="svg5740"
|
||||
height="467.39178"
|
||||
width="467.39178">
|
||||
<defs
|
||||
id="defs5742">
|
||||
<linearGradient
|
||||
id="linearGradient3208">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0.25098041;"
|
||||
id="stop3210"
|
||||
offset="0"
|
||||
id="stop3210" />
|
||||
style="stop-color:#ffffff;stop-opacity:0.25098041;" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
id="stop3212"
|
||||
offset="1"
|
||||
id="stop3212" />
|
||||
style="stop-color:#ffffff;stop-opacity:0;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3195">
|
||||
<stop
|
||||
style="stop-color:#cdcdff;stop-opacity:1;"
|
||||
id="stop3197"
|
||||
offset="0"
|
||||
id="stop3197" />
|
||||
style="stop-color:#cdcdff;stop-opacity:1;" />
|
||||
<stop
|
||||
style="stop-color:#ebebff;stop-opacity:1;"
|
||||
id="stop3199"
|
||||
offset="1"
|
||||
id="stop3199" />
|
||||
style="stop-color:#ebebff;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient6359">
|
||||
<stop
|
||||
style="stop-color:#000d26;stop-opacity:1;"
|
||||
id="stop6361"
|
||||
offset="0"
|
||||
id="stop6361" />
|
||||
style="stop-color:#000d26;stop-opacity:1;" />
|
||||
<stop
|
||||
style="stop-color:#507fda;stop-opacity:1;"
|
||||
id="stop6363"
|
||||
offset="1"
|
||||
id="stop6363" />
|
||||
style="stop-color:#507fda;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 526.18109 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="744.09448 : 526.18109 : 1"
|
||||
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
|
||||
id="perspective5748" />
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter6926"
|
||||
color-interpolation-filters="sRGB">
|
||||
color-interpolation-filters="sRGB"
|
||||
id="filter6926">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="3.5771872"
|
||||
id="feGaussianBlur6928" />
|
||||
id="feGaussianBlur6928"
|
||||
stdDeviation="3.5771872" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient3214"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="463.2301"
|
||||
y2="14.822601"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient3229"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="463.2301"
|
||||
y2="14.822601" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient3279"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="463.2301"
|
||||
y2="14.822601" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient3287"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="463.2301"
|
||||
y2="14.822601"
|
||||
gradientTransform="matrix(1.1122448,0,0,1.2037738,-57.29825,4.8849318)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3195"
|
||||
id="linearGradient3196"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="117.59262"
|
||||
y1="384.05795"
|
||||
y2="436.03787"
|
||||
x2="418.20981"
|
||||
y2="436.03787" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient6359"
|
||||
id="linearGradient3198"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="815.75"
|
||||
y1="480.55844"
|
||||
x2="201.10622"
|
||||
y2="371.85938" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient3200"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.1122448,0,0,1.2037738,-57.29825,4.8849318)"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="469.44925"
|
||||
y2="104.30029" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3195"
|
||||
id="linearGradient3215"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="117.59262"
|
||||
y1="384.05795"
|
||||
x2="418.20981"
|
||||
y2="436.03787" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient6359"
|
||||
id="linearGradient3217"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="815.75"
|
||||
y1="480.55844"
|
||||
x2="201.10622"
|
||||
y2="371.85938" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient3219"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.1122448,0,0,1.2037738,-57.29825,4.8849318)"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="469.44925"
|
||||
y2="104.30029" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient4010"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.7247086,0,0,0.7843464,-109.42065,-2.1325924)"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="469.44925"
|
||||
y2="104.30029" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient6359"
|
||||
id="linearGradient4013"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="815.75"
|
||||
y1="480.55844"
|
||||
x2="201.10622"
|
||||
y2="371.85938"
|
||||
gradientTransform="matrix(0.6515729,0,0,0.6515729,-72.086668,-5.3154816)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3195"
|
||||
id="linearGradient4047"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="117.59262"
|
||||
y1="384.05795"
|
||||
x2="418.20981"
|
||||
y2="436.03787" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient6359"
|
||||
id="linearGradient4049"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="815.75"
|
||||
y1="480.55844"
|
||||
x2="201.10622"
|
||||
y2="371.85938" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient4051"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.1122448,0,0,1.2037738,-57.29825,4.8849318)"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
x2="469.44925"
|
||||
y2="104.30029" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3195"
|
||||
id="linearGradient4053"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="117.59262"
|
||||
y1="384.05795"
|
||||
x2="418.20981"
|
||||
y2="436.03787" />
|
||||
xlink:href="#linearGradient3195" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient6359"
|
||||
id="linearGradient4055"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.6515729,0,0,0.6515729,-72.086668,-5.3154816)"
|
||||
x1="815.75"
|
||||
y1="480.55844"
|
||||
y2="371.85938"
|
||||
x2="201.10622"
|
||||
y2="371.85938" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3208"
|
||||
id="linearGradient4057"
|
||||
y1="480.55844"
|
||||
x1="815.75"
|
||||
gradientTransform="matrix(0.6515729,0,0,0.6515729,-72.086668,-5.3154816)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.7247086,0,0,0.7843464,-109.42065,-2.1325924)"
|
||||
x1="470.25891"
|
||||
y1="276.68851"
|
||||
id="linearGradient4055"
|
||||
xlink:href="#linearGradient6359" />
|
||||
<linearGradient
|
||||
y2="104.30029"
|
||||
x2="469.44925"
|
||||
y2="104.30029" />
|
||||
y1="276.68851"
|
||||
x1="470.25891"
|
||||
gradientTransform="matrix(0.7247086,0,0,0.7843464,-109.42065,-2.1325924)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient4057"
|
||||
xlink:href="#linearGradient3208" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
gridtolerance="10000"
|
||||
guidetolerance="10"
|
||||
objecttolerance="10"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.0119683"
|
||||
inkscape:cx="501.72348"
|
||||
inkscape:cy="187.6618"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer6"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1600"
|
||||
inkscape:window-height="839"
|
||||
inkscape:window-x="1022"
|
||||
inkscape:window-y="-3"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata5745">
|
||||
<rdf:RDF>
|
||||
@ -273,92 +88,56 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Shadow"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-11.872025,-13.171852)"
|
||||
style="display:inline"
|
||||
transform="translate(-11.872025,-13.171852)" />
|
||||
id="layer1" />
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer5"
|
||||
inkscape:label="Border"
|
||||
transform="translate(-11.872025,-13.171852)"
|
||||
style="display:inline"
|
||||
transform="translate(-11.872025,-13.171852)" />
|
||||
id="layer5" />
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
inkscape:label="Rays Background"
|
||||
transform="translate(-11.872025,-13.171852)"
|
||||
style="display:inline"
|
||||
transform="translate(-11.872025,-13.171852)" />
|
||||
id="layer3" />
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Rays Foreground"
|
||||
transform="translate(-11.872025,-13.171852)"
|
||||
style="display:inline"
|
||||
transform="translate(-11.872025,-13.171852)" />
|
||||
id="layer2" />
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer6"
|
||||
inkscape:label="Reflection"
|
||||
transform="translate(-11.872025,-13.171852)"
|
||||
style="display:inline"
|
||||
transform="translate(-11.872025,-13.171852)">
|
||||
id="layer6">
|
||||
<g
|
||||
id="g4018"
|
||||
transform="translate(9.8817328,9.8817328)">
|
||||
transform="translate(9.8817328,9.8817328)"
|
||||
id="g4018">
|
||||
<path
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="/home/raoul/openlp-logo-0.2.png"
|
||||
transform="matrix(0.6379835,0,0,0.6379835,-67.554612,-15.189295)"
|
||||
d="m 833.03006,395.26932 c 0,197.56259 -160.15613,357.71872 -357.71872,357.71872 -197.56259,0 -357.71872,-160.15613 -357.71872,-357.71872 0,-197.5626 160.15613,-357.718722 357.71872,-357.718722 197.56259,0 357.71872,160.156122 357.71872,357.718722 z"
|
||||
sodipodi:ry="357.71872"
|
||||
sodipodi:rx="357.71872"
|
||||
sodipodi:cy="395.26932"
|
||||
sodipodi:cx="475.31134"
|
||||
id="path6903"
|
||||
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline;filter:url(#filter6926)"
|
||||
sodipodi:type="arc" />
|
||||
<path
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="/home/raoul/openlp-logo-0.2.png"
|
||||
sodipodi:type="arc"
|
||||
style="fill:#051e52;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="path6900"
|
||||
sodipodi:cx="475.31134"
|
||||
sodipodi:cy="395.26932"
|
||||
sodipodi:rx="357.71872"
|
||||
sodipodi:ry="357.71872"
|
||||
d="m 833.03006,395.26932 c 0,197.56259 -160.15613,357.71872 -357.71872,357.71872 -197.56259,0 -357.71872,-160.15613 -357.71872,-357.71872 0,-197.5626 160.15613,-357.718722 357.71872,-357.718722 197.56259,0 357.71872,160.156122 357.71872,357.718722 z"
|
||||
id="path6903"
|
||||
d="M 833.03006,395.26932 A 357.71872,357.71872 0 0 1 475.31134,752.98804 357.71872,357.71872 0 0 1 117.59262,395.26932 357.71872,357.71872 0 0 1 475.31134,37.550598 357.71872,357.71872 0 0 1 833.03006,395.26932 Z"
|
||||
transform="matrix(0.6379835,0,0,0.6379835,-67.554612,-15.189295)" />
|
||||
<path
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="/home/raoul/openlp-logo-0.2.png"
|
||||
transform="matrix(0.6317287,0,0,0.6317287,-64.581662,-12.716988)"
|
||||
d="m 833.03006,395.26932 c 0,197.56259 -160.15613,357.71872 -357.71872,357.71872 -197.56259,0 -357.71872,-160.15613 -357.71872,-357.71872 0,-197.5626 160.15613,-357.718722 357.71872,-357.718722 197.56259,0 357.71872,160.156122 357.71872,357.718722 z"
|
||||
sodipodi:ry="357.71872"
|
||||
sodipodi:rx="357.71872"
|
||||
sodipodi:cy="395.26932"
|
||||
sodipodi:cx="475.31134"
|
||||
id="path6317"
|
||||
transform="matrix(0.6379835,0,0,0.6379835,-67.554612,-15.189295)"
|
||||
d="M 833.03006,395.26932 A 357.71872,357.71872 0 0 1 475.31134,752.98804 357.71872,357.71872 0 0 1 117.59262,395.26932 357.71872,357.71872 0 0 1 475.31134,37.550598 357.71872,357.71872 0 0 1 833.03006,395.26932 Z"
|
||||
id="path6900"
|
||||
style="fill:#051e52;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
|
||||
<path
|
||||
style="fill:url(#linearGradient4053);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
sodipodi:type="arc" />
|
||||
id="path6317"
|
||||
d="M 833.03006,395.26932 A 357.71872,357.71872 0 0 1 475.31134,752.98804 357.71872,357.71872 0 0 1 117.59262,395.26932 357.71872,357.71872 0 0 1 475.31134,37.550598 357.71872,357.71872 0 0 1 833.03006,395.26932 Z"
|
||||
transform="matrix(0.6317287,0,0,0.6317287,-64.581662,-12.716988)" />
|
||||
<path
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="/home/raoul/openlp-logo-0.2.png"
|
||||
id="path6327"
|
||||
style="fill:url(#linearGradient4055);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
d="m 235.67972,13.233984 c -35.92776,0 -69.88078,8.488655 -99.97572,23.558433 L 296.72396,165.96674 452.81639,291.19091 c 4.32451,-17.35817 6.61754,-35.51197 6.61754,-54.20272 0,-123.50655 -100.24766,-223.754205 -223.75421,-223.754206 z M 79.118968,77.210299 C 71.146114,85.023824 63.764822,93.431949 57.026574,102.35694 L 274.63156,209.66285 434.20584,288.36064 275.3035,193.86221 79.118968,77.210299 z M 24.488653,162.95322 c -3.62786,10.33827 -6.504275,21.02069 -8.592618,31.98816 L 260.17479,255.29332 422.98657,295.52794 260.21551,241.36595 24.488653,162.95322 z M 13.513722,263.49906 c 1.305042,11.03747 3.397359,21.8274 6.251027,32.31395 l 228.539191,6.51573 173.46093,4.96824 L 253.55725,289.23619 13.513722,263.49906 z M 428.50457,317.76287 249.79034,336.84174 47.782384,358.40473 c 5.959201,9.19899 12.564704,17.94104 19.771165,26.14436 L 244.45559,351.80755 428.50457,317.76287 z m 13.78484,5.21258 -188.36565,62.18449 -133.00232,43.89972 c 33.5632,20.10936 72.81152,31.66237 114.75828,31.66238 93.04288,0 172.8858,-56.87905 206.60969,-137.74659 z"
|
||||
style="fill:url(#linearGradient4055);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
|
||||
id="path6327" />
|
||||
<path
|
||||
id="path3203"
|
||||
style="fill:url(#linearGradient4057);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
d="m 235.67972,13.233984 c -35.92776,0 -69.88078,8.488655 -99.97572,23.558433 l 161.01996,129.174323 52.55342,42.16899 c 39.1477,-4.87501 74.57645,-12.22557 104.45528,-21.44082 C 430.89209,87.375898 341.89666,13.233985 235.67972,13.233984 z M 79.118968,77.210299 c -7.972854,7.813525 -15.354146,16.22165 -22.092394,25.146641 l 217.604986,107.30591 8.32792,4.11306 c 7.91353,-0.38016 15.72478,-0.85776 23.43626,-1.42532 L 275.3035,193.86221 79.118968,77.210299 z M 24.488653,162.95322 c -2.661786,7.58527 -4.921793,15.36128 -6.760069,23.29373 42.624133,13.3171 96.712956,22.78306 156.947626,26.67377 L 24.488653,162.95322 z"
|
||||
style="fill:url(#linearGradient4057);fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline" />
|
||||
id="path3203" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 6.4 KiB |
@ -189,16 +189,14 @@ class TestLib(TestCase):
|
||||
"""
|
||||
Test the build_icon() function with a QIcon instance
|
||||
"""
|
||||
with patch('openlp.core.lib.QtGui') as MockedQtGui:
|
||||
# GIVEN: A mocked QIcon
|
||||
MockedQtGui.QIcon = MagicMock
|
||||
mocked_icon = MockedQtGui.QIcon()
|
||||
# GIVEN: An icon QIcon
|
||||
icon = QtGui.QIcon()
|
||||
|
||||
# WHEN: We pass a QIcon instance in
|
||||
result = build_icon(mocked_icon)
|
||||
result = build_icon(icon)
|
||||
|
||||
# THEN: The result should be our mocked QIcon
|
||||
self.assertIs(mocked_icon, result, 'The result should be the mocked QIcon')
|
||||
# THEN: The result should be the same icon as we passed in
|
||||
self.assertIs(icon, result, 'The result should be the same icon as we passed in')
|
||||
|
||||
def test_build_icon_with_resource(self):
|
||||
"""
|
||||
@ -223,6 +221,30 @@ class TestLib(TestCase):
|
||||
self.assertIsInstance(result, MagicMock, 'The result should be a MagicMock, because we mocked it out')
|
||||
|
||||
def test_image_to_byte(self):
|
||||
"""
|
||||
Test the image_to_byte() function
|
||||
"""
|
||||
with patch('openlp.core.lib.QtCore') as MockedQtCore:
|
||||
# GIVEN: A set of mocked-out Qt classes
|
||||
mocked_byte_array = MagicMock()
|
||||
MockedQtCore.QByteArray.return_value = mocked_byte_array
|
||||
mocked_buffer = MagicMock()
|
||||
MockedQtCore.QBuffer.return_value = mocked_buffer
|
||||
MockedQtCore.QIODevice.WriteOnly = 'writeonly'
|
||||
mocked_image = MagicMock()
|
||||
|
||||
# WHEN: We convert an image to a byte array
|
||||
result = image_to_byte(mocked_image, base_64=False)
|
||||
|
||||
# THEN: We should receive the mocked_buffer
|
||||
MockedQtCore.QByteArray.assert_called_with()
|
||||
MockedQtCore.QBuffer.assert_called_with(mocked_byte_array)
|
||||
mocked_buffer.open.assert_called_with('writeonly')
|
||||
mocked_image.save.assert_called_with(mocked_buffer, "PNG")
|
||||
self.assertFalse(mocked_byte_array.toBase64.called)
|
||||
self.assertEqual(mocked_byte_array, result, 'The mocked out byte array should be returned')
|
||||
|
||||
def test_image_to_byte_base_64(self):
|
||||
"""
|
||||
Test the image_to_byte() function
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user