Merge branch 'master' into text-drawing

This commit is contained in:
ziajka 2018-05-16 09:24:50 +02:00
commit e0ccfda3e2
3 changed files with 776 additions and 1697 deletions

View File

@ -17,7 +17,6 @@
import os import os
import re import re
import pip
import sys import sys
import shutil import shutil
import psutil import psutil
@ -95,7 +94,7 @@ def download_command(arguments):
else: else:
requirements = 'requirements.txt' requirements = 'requirements.txt'
pip.main(['install', '-r', os.path.join(source_directory, requirements)]) subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', os.path.join(source_directory, requirements)])
def build_command(arguments): def build_command(arguments):

View File

@ -76,26 +76,28 @@ describe('InterfaceLabelsWidget', () => {
it('should draw interface labels', () => { it('should draw interface labels', () => {
widget.draw(linksEnter); widget.draw(linksEnter);
const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('text.interface_label'); const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('g.interface_label_container');
expect(drew.nodes().length).toEqual(2); expect(drew.nodes().length).toEqual(2);
const sourceInterface = drew.nodes()[0]; const sourceInterface = drew.nodes()[0];
expect(sourceInterface.innerHTML).toEqual('Interface 1');
expect(sourceInterface.getAttribute('x')).toEqual('110');
expect(sourceInterface.getAttribute('y')).toEqual('237');
expect(sourceInterface.getAttribute('transform')).toEqual('rotate(5, 110, 220)');
expect(sourceInterface.getAttribute('style')).toEqual('font-size:12px');
expect(sourceInterface.getAttribute('class')).toContain('noselect');
expect(sourceInterface.getAttribute('transform')).toEqual('translate(110, 220) rotate(5, 110, 220)');
const sourceIntefaceRect = sourceInterface.firstChild;
expect(sourceIntefaceRect.attributes.getNamedItem('class').value).toEqual('interface_label_border');
const sourceIntefaceText = sourceInterface.children[1];
expect(sourceIntefaceText.attributes.getNamedItem('class').value).toEqual('interface_label noselect');
expect(sourceIntefaceText.attributes.getNamedItem('style').value).toEqual('font-size:12px');
const targetInterface = drew.nodes()[1]; const targetInterface = drew.nodes()[1];
expect(targetInterface.innerHTML).toEqual('Interface 2');
expect(targetInterface.getAttribute('x')).toEqual('270'); expect(targetInterface.getAttribute('transform')).toEqual('translate(270, 360) rotate(0, 270, 360)');
expect(targetInterface.getAttribute('y')).toEqual('377'); const targetIntefaceRect = targetInterface.firstChild;
expect(targetInterface.getAttribute('transform')).toEqual('rotate(0, 270, 360)'); expect(targetIntefaceRect.attributes.getNamedItem('class').value).toEqual('interface_label_border');
expect(targetInterface.getAttribute('style')).toEqual(''); const targetIntefaceText = targetInterface.children[1];
expect(targetInterface.getAttribute('class')).toContain('noselect'); expect(targetIntefaceText.attributes.getNamedItem('class').value).toEqual('interface_label noselect');
expect(targetIntefaceText.attributes.getNamedItem('style').value).toEqual('');
}); });
it('should draw interface label with class `selected` when selected', () => { it('should draw interface label with class `selected` when selected', () => {
@ -103,8 +105,7 @@ describe('InterfaceLabelsWidget', () => {
widget.draw(linksEnter); widget.draw(linksEnter);
const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('text.interface_label'); const drew = svg.canvas.selectAll<SVGGElement, InterfaceLabel>('g.interface_label_container');
const sourceInterface = drew.nodes()[0]; const sourceInterface = drew.nodes()[0];
expect(sourceInterface.getAttribute('class')).toContain('selected'); expect(sourceInterface.getAttribute('class')).toContain('selected');
}); });

2439
yarn.lock

File diff suppressed because it is too large Load Diff