-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b22881b
commit a3c5f63
Showing
85 changed files
with
12,471 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2009-2022 by SVG-edit authors (see AUTHORS file) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../support/ui-test-helper.js' | ||
|
||
describe('UI - Clipboard', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('Editor - Copy and paste', () => { | ||
cy.get('#tool_source').click({ force: true }) | ||
|
||
cy.get('#svg_source_textarea') | ||
.type('{selectall}', { force: true }) | ||
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> | ||
<g class="layer"> | ||
<title>Layer 1</title> | ||
<circle cx="100" cy="100" r="50" fill="#FF0000" id="testCircle" stroke="#000000" stroke-width="5"/> | ||
</g> | ||
</svg>`, { force: true, parseSpecialCharSequences: false }) | ||
cy.get('#tool_source_save').click({ force: true }) | ||
cy.get('#testCircle').should('exist') | ||
cy.get('#svg_1').should('not.exist') | ||
cy.get('#svg_2').should('not.exist') | ||
|
||
// Copy. | ||
cy.get('#testCircle').click({ force: true }).rightclick({ force: true }) | ||
cy.get('#cmenu_canvas a[href="#copy"]').click({ force: true }) | ||
|
||
// Paste. | ||
// Scrollbars fail to recenter in Cypress test. Works fine in reality. | ||
// Thus forcing click is needed since workspace is mostly offscreen. | ||
cy.get('#svgroot').rightclick({ force: true }) | ||
cy.get('#cmenu_canvas a[href="#paste"]').click({ force: true }) | ||
cy.get('#testCircle').should('exist') | ||
cy.get('#svg_1').should('exist') | ||
cy.get('#svg_2').should('not.exist') | ||
|
||
// Cut. | ||
cy.get('#testCircle').click({ force: true }).rightclick({ force: true }) | ||
cy.get('#cmenu_canvas a[href="#cut"]').click({ force: true }) | ||
cy.get('#testCircle').should('not.exist') | ||
cy.get('#svg_1').should('exist') | ||
cy.get('#svg_2').should('not.exist') | ||
|
||
// Paste. | ||
// Scrollbars fail to recenter in Cypress test. Works fine in reality. | ||
// Thus forcing click is needed since workspace is mostly offscreen. | ||
cy.get('#svgroot').rightclick({ force: true }) | ||
cy.get('#cmenu_canvas a[href="#paste"]').click({ force: true }) | ||
cy.get('#testCircle').should('not.exist') | ||
cy.get('#svg_1').should('exist') | ||
cy.get('#svg_2').should('exist') | ||
|
||
// Delete. | ||
cy.get('#svg_2').click({ force: true }).rightclick({ force: true }) | ||
cy.get('#cmenu_canvas a[href="#delete"]').click({ force: true }) | ||
cy.get('#svg_1').click({ force: true }).rightclick({ force: true }) | ||
cy.get('#cmenu_canvas a[href="#delete"]').click({ force: true }) | ||
cy.get('#svg_1').should('not.exist') | ||
cy.get('#svg_2').should('not.exist') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../support/ui-test-helper.js' | ||
|
||
describe('UI - Control Points', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('Editor - No parameters: Drag control point of arc path', () => { | ||
const randomOffset = () => 2 + Math.round(10 + Math.random() * 40) | ||
cy.get('#tool_source').click({ force: true }) | ||
cy.get('#svg_source_textarea') | ||
.type('{selectall}', { force: true }) | ||
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> | ||
<g class="layer"> | ||
<title>Layer 1</title> | ||
<path d="m187,194a114,62 0 1 0 219,2" id="svg_1" fill="#FF0000" stroke="#000000" stroke-width="5"/> | ||
</g> | ||
</svg>`, { force: true, parseSpecialCharSequences: false }) | ||
cy.get('#tool_source_save').click({ force: true }) | ||
|
||
cy.get('#svg_1').click({ force: true }).click({ force: true }) | ||
|
||
cy.get('#pathpointgrip_0').trigger('mousedown', { which: 1, force: true }) | ||
.trigger('mousemove', randomOffset(), randomOffset(), { force: true }) | ||
.trigger('mouseup', { force: true }) | ||
cy.get('#pathpointgrip_1').trigger('mousedown', { which: 1, force: true }) | ||
.trigger('mousemove', randomOffset(), randomOffset(), { force: true }) | ||
.trigger('mouseup', { force: true }) | ||
|
||
cy.get('#svg_1[d]').should('not.contain', 'NaN') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
visitAndApproveStorage, openMainMenu | ||
} from '../../support/ui-test-helper.js' | ||
|
||
describe('UI - Export tests', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('Editor - No parameters: Has export button', () => { | ||
openMainMenu() | ||
cy.get('#tool_export') | ||
}) | ||
|
||
it('Editor - No parameters: Export button clicking; dialog opens', () => { | ||
openMainMenu() | ||
cy.get('#tool_export').click({ force: true }) | ||
cy.get('#dialog_content select') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../../support/ui-test-helper.js' | ||
|
||
// See https://github.com/SVG-Edit/svgedit/issues/359 | ||
describe('Fix issue 359', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('can undo without throwing', function () { | ||
cy.get('#tool_source').click({ force: true }) | ||
cy.get('#svg_source_textarea') | ||
.type('{selectall}', { force: true }) | ||
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> | ||
<g class="layer"> | ||
<title>Layer 1</title> | ||
<rect fill="#ffff00" height="70" width="165" x="179.5" y="146.5"/> | ||
</g> | ||
</svg>`, { parseSpecialCharSequences: false, force: true }) | ||
cy.get('#tool_source_save').click({ force: true }) | ||
cy.get('#tool_undo').click({ force: true }) | ||
cy.get('#tool_redo').click({ force: true }) // test also redo to make the test more comprehensive | ||
// if the undo throws an error to the console, the test will fail | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../../support/ui-test-helper.js' | ||
|
||
// See https://github.com/SVG-Edit/svgedit/issues/407 | ||
describe('Fix issue 407', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
it('can enter edit on text child', function () { | ||
cy.get('#tool_source').click({ force: true }) | ||
cy.get('#svg_source_textarea') | ||
.type('{selectall}', { force: true }) | ||
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> | ||
<g class="layer"> | ||
<title>Layer 1</title> | ||
<g> | ||
<rect fill="#ffff00" height="70" width="165" x="179.5" y="146.5"/> | ||
<text fill="#000000" id="a_text" text-anchor="middle" x="260.5" xml:space="preserve" y="192.5">hello</text> | ||
</g> | ||
</g> | ||
</svg>`, { force: true, parseSpecialCharSequences: false }) | ||
cy.get('#tool_source_save').click({ force: true }) | ||
cy.get('#svg_1').click({ force: true }).dblclick({ force: true }) | ||
cy.get('#a_text').should('exist') | ||
/** @todo: need to understand the reason why this test now fails */ | ||
// cy.get('#a_text') | ||
// .trigger('mousedown', { which: 1, force: true }) | ||
// .trigger('mouseup', { force: true }) | ||
// .dblclick({ force: true }) | ||
// svgedit use the #text text field to capture the text | ||
// cy.get('#text').type('1234', {force: true}) | ||
// cy.get('#a_text').should('have.text', 'he1234llo') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../../support/ui-test-helper.js' | ||
|
||
// See https://github.com/SVG-Edit/svgedit/issues/408 | ||
describe('Fix issue 408', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('should not throw when showing/saving svg content', function () { | ||
cy.get('#tool_source').click({ force: true }) | ||
cy.get('#svg_source_textarea') | ||
.type('{selectall}', { force: true }) | ||
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> | ||
<g class="layer"> | ||
<title>Layer 1</title> | ||
<g id="svg_6"> | ||
<rect fill="#FF0000" height="71" stroke="#000000" stroke-width="5" width="94" x="69.5" y="51.5"/> | ||
<circle cx="117.5" cy="87.5" fill="#ffff00" r="19.84943" stroke="#000000" /> | ||
</g> | ||
</g> | ||
</svg>`, { force: true, parseSpecialCharSequences: false }) | ||
cy.get('#tool_source_save').click({ force: true }) | ||
cy.get('#svg_6').click({ force: true }).dblclick({ force: true }) // change context | ||
cy.get('#tool_source').click({ force: true }) // reopen tool_source | ||
cy.get('#tool_source_save').should('exist') // The save button should be here if it does not throw | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../../support/ui-test-helper.js' | ||
|
||
// See https://github.com/SVG-Edit/svgedit/issues/423 | ||
describe('Fix issue 423', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('should not throw when undoing the move', function () { | ||
cy.get('#tool_source').click({ force: true }) | ||
cy.get('#svg_source_textarea') | ||
.type('{selectall}', { force: true }) | ||
.type(`<svg width="300" height="300" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> | ||
<g class="layer"> | ||
<title>Layer 1</title> | ||
<g class="layer" id="svg_1"> | ||
<clipPath id="svg_2"> | ||
<rect height="150" id="svg_3" width="50" x="50" y="50"/> | ||
</clipPath> | ||
<rect clip-path="url(#svg_2)" fill="#0033b5" height="174.9" id="TANK1" width="78" x="77.5" y="29"/> | ||
</g> | ||
</g> | ||
</svg>`, { parseSpecialCharSequences: false, force: true }) | ||
cy.get('#tool_source_save').click({ force: true }) | ||
cy.get('#TANK1') | ||
.trigger('mousedown', { force: true }) | ||
.trigger('mousemove', 50, 0, { force: true }) | ||
.trigger('mouseup', { force: true }) | ||
cy.get('#tool_undo').click({ force: true }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../../support/ui-test-helper.js' | ||
|
||
// See https://github.com/SVG-Edit/svgedit/issues/660 | ||
describe('Fix issue 660', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
cy.viewport(512, 512) | ||
}) | ||
/** @todo: reenable this test when we understand why it is passing locally but not on ci */ | ||
it.skip('can resize text', function () { | ||
cy.get('#tool_source').click({ force: true }) | ||
cy.get('#svg_source_textarea') | ||
.type('{selectall}', { force: true }) | ||
.type(`<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg"> | ||
<g class="layer"> | ||
<title>Layer 1</title> | ||
<text fill="#000000" id="a_text" text-anchor="middle" x="260.5" xml:space="preserve" y="192.5" font-size="40">hello</text> | ||
</g> | ||
</svg>`, { force: true, parseSpecialCharSequences: false }) | ||
cy.get('#tool_source_save').click({ force: true }) | ||
cy.get('#a_text').should('exist') | ||
cy.get('#a_text') | ||
.trigger('mousedown', { which: 1, force: true }) | ||
.trigger('mouseup', { force: true }) | ||
cy.get('#selectorGrip_resize_s') | ||
.trigger('mousedown', { which: 1, force: true }) | ||
.trigger('mousemove', { clientX: 0, clientY: 600 }) | ||
.trigger('mouseup', { force: true }) | ||
// svgedit use the #text text field to capture the text | ||
cy.get('#a_text').should('have.attr', 'transform') | ||
.and('equal', 'matrix(1 0 0 4.54639 0 -540.825)') // Chrome 96 is matrix(1 0 0 4.17431 0 -325.367) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../../support/ui-test-helper.js' | ||
|
||
// See https://github.com/SVG-Edit/svgedit/issues/699 | ||
describe('Fix issue 699', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('should not throw error when undoing and redoing convert to path for a rectangle', function () { | ||
cy.get('#tool_rect') | ||
.click({ force: true }) | ||
cy.get('#svgcontent') | ||
.trigger('mousedown', 150, 150, { force: true }) | ||
.trigger('mousemove', 250, 200, { force: true }) | ||
.trigger('mouseup', { force: true }) | ||
cy.get('#tool_topath') // Check if undo redo is correct for tool_topath with tool_rect | ||
.click({ force: true }) | ||
cy.get('#tool_undo') | ||
.click({ force: true }) | ||
cy.get('#tool_redo') | ||
.click({ force: true }) | ||
cy.get('#tool_undo') // Do twice just to make sure | ||
.click({ force: true }) | ||
cy.get('#tool_redo') | ||
.click({ force: true }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { | ||
visitAndApproveStorage | ||
} from '../../../support/ui-test-helper.js' | ||
|
||
// See https://github.com/SVG-Edit/svgedit/issues/726 | ||
describe('Fix issue 726', function () { | ||
beforeEach(() => { | ||
visitAndApproveStorage() | ||
}) | ||
|
||
it('Send forward and send backward should move one layer at a time', function () { | ||
cy.get('#tool_rect') | ||
.click({ force: true }) | ||
cy.get('#svgcontent') | ||
.trigger('mousedown', 250, 250, { force: true }) | ||
.trigger('mousemove', 350, 350, { force: true }) | ||
.trigger('mouseup', { force: true }) | ||
cy.wait(300) | ||
cy.get('#tool_rect') | ||
.click({ force: true }) | ||
cy.get('#svgcontent') | ||
.trigger('mousedown', 10, 0, { force: true }) | ||
.trigger('mousemove', 100, 100, { force: true }) | ||
.trigger('mouseup', { force: true }) | ||
cy.wait(300) | ||
cy.get('#tool_rect') | ||
.click({ force: true }) | ||
cy.get('#svgcontent') | ||
.trigger('mousedown', 10, 10, { force: true }) | ||
.trigger('mousemove', 100, 100, { force: true }) | ||
.trigger('mouseup', { force: true }) | ||
cy.wait(300) | ||
cy.get('#svg_3') | ||
.rightclick(0, 0, { force: true }) | ||
cy.get('a:contains("Send Backward")').click({ force: true }) | ||
cy.get('#svg_2').should(($div) => { | ||
const id = $div[0].previousElementSibling.id | ||
assert.equal(id, 'svg_3') | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.