Skip to content

Commit

Permalink
#2070 - Settings for the "attachment point tool" don't update with c…
Browse files Browse the repository at this point in the history
…hanged pixel settings

Fix code to render attachment point same width as bonds. Add UT
  • Loading branch information
AliaksandrDziarkach committed Oct 2, 2024
1 parent 704673f commit 70982b3
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 90 deletions.
176 changes: 89 additions & 87 deletions api/tests/integration/ref/rendering/render_rgroups.py.out
Original file line number Diff line number Diff line change
@@ -1,87 +1,89 @@
rgroups/rgroup-mol-rec1.png rendering status: OK
rgroups/rgroup-qmol-rec1.png rendering status: OK
rgroups/noap-mol-rec1.png rendering status: OK
rgroups/noap-qmol-rec1.png rendering status: OK
rgroups/norgroup-mol-rec1.png rendering status: OK
rgroups/norgroup-qmol-rec1.png rendering status: OK
rec1 OK
rgroups/rgroup-mol-occur.png rendering status: OK
rgroups/rgroup-qmol-occur.png rendering status: OK
rgroups/noap-mol-occur.png rendering status: OK
rgroups/noap-qmol-occur.png rendering status: OK
rgroups/norgroup-mol-occur.png rendering status: OK
rgroups/norgroup-qmol-occur.png rendering status: OK
occur OK
rgroups/rgroup-mol-resth.png rendering status: OK
rgroups/rgroup-qmol-resth.png rendering status: OK
rgroups/noap-mol-resth.png rendering status: OK
rgroups/noap-qmol-resth.png rendering status: OK
rgroups/norgroup-mol-resth.png rendering status: OK
rgroups/norgroup-qmol-resth.png rendering status: OK
resth OK
rgroups/rgroup-mol-2ap.png rendering status: OK
rgroups/rgroup-qmol-2ap.png rendering status: OK
rgroups/noap-mol-2ap.png rendering status: OK
rgroups/noap-qmol-2ap.png rendering status: OK
rgroups/norgroup-mol-2ap.png rendering status: OK
rgroups/norgroup-qmol-2ap.png rendering status: OK
2ap OK






rec1 OK






occur OK






resth OK






2ap OK
*** R-groups and attachment points ***
0:
rgroups/deco_set1_1_hi.png rendering status: OK
rgroups/deco_set1_1.png rendering status: OK


1:
rgroups/deco_set1_2_hi.png rendering status: OK
rgroups/deco_set1_2.png rendering status: OK


2:
rgroups/deco_set1_3_hi.png rendering status: OK
rgroups/deco_set1_3.png rendering status: OK


3:
rgroups/deco_set1_4_hi.png rendering status: OK
rgroups/deco_set1_4.png rendering status: OK


4:
rgroups/deco_set1_5_hi.png rendering status: OK
rgroups/deco_set1_5.png rendering status: OK


5:
rgroups/deco_set1_6_hi.png rendering status: OK
rgroups/deco_set1_6.png rendering status: OK


rgroups/rgroup-mol-rec1.png rendering status: OK
rgroups/rgroup-qmol-rec1.png rendering status: OK
rgroups/noap-mol-rec1.png rendering status: OK
rgroups/noap-qmol-rec1.png rendering status: OK
rgroups/norgroup-mol-rec1.png rendering status: OK
rgroups/norgroup-qmol-rec1.png rendering status: OK
rec1 OK
rgroups/rgroup-mol-occur.png rendering status: OK
rgroups/rgroup-qmol-occur.png rendering status: OK
rgroups/noap-mol-occur.png rendering status: OK
rgroups/noap-qmol-occur.png rendering status: OK
rgroups/norgroup-mol-occur.png rendering status: OK
rgroups/norgroup-qmol-occur.png rendering status: OK
occur OK
rgroups/rgroup-mol-resth.png rendering status: OK
rgroups/rgroup-qmol-resth.png rendering status: OK
rgroups/noap-mol-resth.png rendering status: OK
rgroups/noap-qmol-resth.png rendering status: OK
rgroups/norgroup-mol-resth.png rendering status: OK
rgroups/norgroup-qmol-resth.png rendering status: OK
resth OK
rgroups/rgroup-mol-2ap.png rendering status: OK
rgroups/rgroup-qmol-2ap.png rendering status: OK
rgroups/noap-mol-2ap.png rendering status: OK
rgroups/noap-qmol-2ap.png rendering status: OK
rgroups/norgroup-mol-2ap.png rendering status: OK
rgroups/norgroup-qmol-2ap.png rendering status: OK
2ap OK






rec1 OK






occur OK






resth OK






2ap OK
*** R-groups and attachment points ***
0:
rgroups/deco_set1_1_hi.png rendering status: OK
rgroups/deco_set1_1.png rendering status: OK


1:
rgroups/deco_set1_2_hi.png rendering status: OK
rgroups/deco_set1_2.png rendering status: OK


2:
rgroups/deco_set1_3_hi.png rendering status: OK
rgroups/deco_set1_3.png rendering status: OK


3:
rgroups/deco_set1_4_hi.png rendering status: OK
rgroups/deco_set1_4.png rendering status: OK


4:
rgroups/deco_set1_5_hi.png rendering status: OK
rgroups/deco_set1_5.png rendering status: OK


5:
rgroups/deco_set1_6_hi.png rendering status: OK
rgroups/deco_set1_6.png rendering status: OK


Test issue 2070 attachment point width
rgroups/issue_2070.png rendering status: OK
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions api/tests/integration/tests/rendering/render_rgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
os.path.join(os.path.abspath(__file__), "..", "..", "..", "common")
)
)
from env_indigo import * # noqa
from rendering import *
from env_indigo import Indigo, IndigoRenderer, isIronPython, joinPathPy
from rendering import checkImageSimilarity

indigo = Indigo()
renderer = IndigoRenderer(indigo)
Expand Down Expand Up @@ -216,6 +216,19 @@ def render_molobj(mol_):
"""
)

print("Test issue 2070 attachment point width")

indigo.resetOptions()
indigo.setOption("render-output-format", "png")
indigo.setOption("render-bond-thickness", 5)
fname = joinPathPy("molecules/r1-2ap-aal.mol", __file__)
mol = indigo.loadMoleculeFromFile(fname)
qmol = indigo.loadQueryMoleculeFromFile(fname)
png_file = "rgroups/issue_2070.png"
renderer.renderToFile(mol, joinPathPy("out/" + png_file, __file__))
print(checkImageSimilarity(png_file))


if isIronPython():
renderer.Dispose()
indigo.Dispose()
2 changes: 1 addition & 1 deletion core/render2d/src/render_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ void RenderContext::drawAttachmentPoint(RenderItemAttachmentPoint& ri, bool idle
setSingleSource(ri.color);
if (ri.highlighted && opt.highlightColorEnable)
setSingleSource(opt.highlightColor);
setLineWidth(_settings.unit);
setLineWidth(_settings.bondLineWidth);
moveTo(ri.p0);
lineTo(ri.p1);
checkPathNonEmpty();
Expand Down

0 comments on commit 70982b3

Please sign in to comment.