}
}
}
- if (E_arrowhead && (*eflag == ARR_TYPE_NORM) && ((attr = agxget(e, E_arrowhead)))[0])
- arrow_match_name(attr, eflag);
- if (E_arrowtail && (*sflag == ARR_TYPE_NORM) && ((attr = agxget(e, E_arrowtail)))[0])
- arrow_match_name(attr, sflag);
+ if (*eflag == ARR_TYPE_NORM) {
+ /* we cannot use the pre-constructed E_arrowhead here because the order in
+ * which edge attributes appear and are thus parsed into a dictionary mean
+ * E_arrowhead->id potentially points at a stale attribute value entry
+ */
+ Agsym_t *arrowhead = agfindedgeattr(agraphof(e), "arrowhead");
+ if (arrowhead != NULL && ((attr = agxget(e, arrowhead)))[0])
+ arrow_match_name(attr, eflag);
+ }
+ if (*sflag == ARR_TYPE_NORM) {
+ /* similar to above, we cannot use E_arrowtail here */
+ Agsym_t *arrowtail = agfindedgeattr(agraphof(e), "arrowtail");
+ if (arrowtail != NULL && ((attr = agxget(e, arrowtail)))[0])
+ arrow_match_name(attr, sflag);
+ }
if (ED_conc_opp_flag(e)) {
edge_t *f;
int s0, e0;
# has been reintroduced
subprocess.check_call(['dot', '-Tsvg', '-o', os.devnull, input])
+def test_1444():
+ '''
+ specifying 'headport' as an edge attribute should work regardless of what
+ order attributes appear in
+ https://gitlab.com/graphviz/graphviz/-/issues/1444
+ '''
+
+ # locate the first of our associated tests
+ input1 = os.path.join(os.path.dirname(__file__), '1444.dot')
+ assert os.path.exists(input1), 'unexpectedly missing test case'
+
+ # ask Graphviz to process it
+ p = subprocess.Popen(['dot', '-Tsvg', input1], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, universal_newlines=True)
+ stdout1, stderr = p.communicate()
+
+ assert p.returncode == 0, 'failed to process a headport edge'
+
+ assert stderr.strip() == '', 'emitted an error for a legal graph'
+
+ # now locate our second variant, that simply has the attributes swapped
+ input2 = os.path.join(os.path.dirname(__file__), '1444-2.dot')
+ assert os.path.exists(input2), 'unexpectedly missing test case'
+
+ # process it identically
+ p = subprocess.Popen(['dot', '-Tsvg', input2], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, universal_newlines=True)
+ stdout2, stderr = p.communicate()
+
+ assert p.returncode == 0, 'failed to process a headport edge'
+
+ assert stderr.strip() == '', 'emitted an error for a legal graph'
+
+ assert stdout1 == stdout2, \
+ 'swapping edge attributes altered the output graph'
+
def test_1449():
'''
using the SVG color scheme should not cause warnings