cypress_test/data/mobile/impress/apply_font.odp |binary cypress_test/integration_tests/mobile/impress/apply_font_spec.js | 291 ++++++++++ cypress_test/integration_tests/mobile/impress/slide_properties_spec.js | 18 3 files changed, 309 insertions(+)
New commits: commit 9dba400fb1908af178a5b24d38b4754ebc1560fa Author: Tamás Zolnai <[email protected]> AuthorDate: Thu May 28 14:06:54 2020 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Thu May 28 18:56:53 2020 +0200 cypress: tests for applying text properties on text shape (impress, mobile) Change-Id: I8715b853456b04565db2b524ffec3b6429c657fe Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95032 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Tamás Zolnai <[email protected]> diff --git a/cypress_test/data/mobile/impress/apply_font.odp b/cypress_test/data/mobile/impress/apply_font.odp new file mode 100644 index 000000000..ea02789d1 Binary files /dev/null and b/cypress_test/data/mobile/impress/apply_font.odp differ diff --git a/cypress_test/integration_tests/mobile/impress/apply_font_spec.js b/cypress_test/integration_tests/mobile/impress/apply_font_spec.js new file mode 100644 index 000000000..e534bd107 --- /dev/null +++ b/cypress_test/integration_tests/mobile/impress/apply_font_spec.js @@ -0,0 +1,291 @@ +/* global describe it cy beforeEach require expect afterEach*/ + +var helper = require('../../common/helper'); +var mobileHelper = require('../../common/mobile_helper'); + +describe('Apply font on text shape.', function() { + var testFileName = 'apply_font.odp'; + + beforeEach(function() { + mobileHelper.beforeAllMobile(testFileName, 'impress'); + + mobileHelper.enableEditingMobile(); + + selectTextShape(); + + mobileHelper.openMobileWizard(); + + cy.get('#TextPropertyPanel') + .click(); + }); + + afterEach(function() { + helper.afterAll(testFileName); + }); + + function selectTextShape() { + // Click on the center of the slide to select the text shape there + cy.get('#document-container') + .then(function(items) { + expect(items).to.have.length(1); + var XPos = (items[0].getBoundingClientRect().left + items[0].getBoundingClientRect().right) / 2; + var YPos = (items[0].getBoundingClientRect().top + items[0].getBoundingClientRect().bottom) / 2; + cy.get('body') + .click(XPos, YPos); + }); + + cy.get('.leaflet-drag-transform-marker') + .should('be.visible'); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page g') + .should('have.class', 'com.sun.star.drawing.TextShape'); + } + + function triggerNewSVG() { + mobileHelper.closeMobileWizard(); + + // Remove selection first with clicking next to the rotate handler + cy.get('.transform-handler--rotate') + .then(function(items) { + var XPos = items[0].getBoundingClientRect().left - 10; + var YPos = items[0].getBoundingClientRect().top; + cy.get('body') + .click(XPos, YPos); + }); + + cy.get('.leaflet-drag-transform-marker') + .should('not.exist'); + + // If we click two fast on shape again + // then it steps into edit mode + cy.wait(200); + + // Select text shape again which will retrigger a new SVG from core + selectTextShape(); + } + + it('Apply bold.', function() { + cy.get('#Bold') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-weight', '700'); + }); + + it('Apply italic.', function() { + + cy.get('#Italic') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-style', 'italic'); + }); + + it('Apply underline.', function() { + + cy.get('#Underline') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'text-decoration', 'underline'); + }); + + it('Apply strikeout.', function() { + + cy.get('#Strikeout') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'text-decoration', 'line-through'); + }); + + it('Apply shadowed.', function() { + + cy.get('#Shadowed') + .click(); + + triggerNewSVG(); + + cy.wait(400); + // TODO: shadowed property is not in the SVG + }); + + it('Change font name.', function() { + cy.get('#fontnamecombobox') + .click(); + + cy.contains('.ui-combobox-text', 'Linux Libertine G') + .click(); + + cy.get('#mobile-wizard-back') + .click(); + + cy.get('#fontnamecombobox .ui-header-right .entry-value') + .should('have.text', 'Linux Libertine G'); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-family', 'Linux Libertine G'); + }); + + it('Change font size.', function() { + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '635px'); + + cy.get('#fontsizecombobox') + .click(); + + cy.contains('.mobile-wizard.ui-combobox-text', '24') + .click(); + + cy.get('#mobile-wizard-back') + .click(); + + cy.get('#fontsizecombobox .ui-header-right .entry-value') + .should('have.text', '24'); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '847px'); + }); + + it('Grow font size.', function() { + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '635px'); + + cy.get('#Grow') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '705px'); + }); + + it('Shrink font size.', function() { + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '635px'); + + cy.get('#Shrink') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '564px'); + }); + + it.skip('Apply text color.', function() { + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('not.have.attr', 'font-color'); + + cy.get('#Color') + .click(); + + cy.get('#color-picker-0-basic-color-5') + .click(); + + cy.get('#color-picker-0-tint-2') + .click(); + + cy.get('#mobile-wizard-back') + .click(); + + triggerNewSVG(); + + // TODO: text color is not applied on the shape + }); + + it.skip('Apply highlight.', function() { + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('not.have.attr', 'font-color'); + + cy.get('#CharBackColor') + .click(); + + cy.get('#color-picker-1-basic-color-2') + .click(); + + cy.get('#color-picker-1-tint-2') + .click(); + + cy.get('#mobile-wizard-back') + .click(); + + triggerNewSVG(); + + // TODO: highlight color is not applied on the shape + }); + + it('Apply superscript.', function() { + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition') + .should('have.attr', 'y', '3495'); + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '635px'); + + cy.get('#SuperScript') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition') + .should('have.attr', 'y', '3285'); + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '368px'); + }); + + it('Apply subscript.', function() { + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition') + .should('have.attr', 'y', '3495'); + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '635px'); + + cy.get('#SubScript') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition') + .should('have.attr', 'y', '3705'); + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '368px'); + }); + + it('Clear direct formatting.', function() { + // Change the font size first + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '635px'); + + cy.get('#Grow') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '705px'); + + // Remove direct formatting + mobileHelper.openMobileWizard(); + + cy.get('#TextPropertyPanel') + .click(); + + cy.get('#clearFormatting') + .click(); + + triggerNewSVG(); + + cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextParagraph') + .should('have.attr', 'font-size', '635px'); + }); +}); commit 5499c6fdd48fa97afe6d18bbc063739eb2dc7bb8 Author: Tamás Zolnai <[email protected]> AuthorDate: Thu May 28 11:51:00 2020 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Thu May 28 18:56:46 2020 +0200 cypress: test also switching back to normal view. Change-Id: Ie8b484e68c35733ba7701f0d6ae0311c01f1cca5 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95031 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Tamás Zolnai <[email protected]> diff --git a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js index fc8e47491..ffab7b1b4 100644 --- a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js +++ b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js @@ -611,5 +611,23 @@ describe('Changing slide properties.', function() { cy.get('#displaymasterobjects label') .should('have.class', 'disabled'); + + // Switch back to normal mode + cy.get('#closemasterslide') + .click(); + + cy.get('#masterslidebutton') + .should('exist'); + + previewShouldBeFullWhite(); + + cy.get('#masterslide') + .should('not.have.class', 'disabled'); + + cy.get('#displaymasterbackground label') + .should('not.have.class', 'disabled'); + + cy.get('#displaymasterobjects label') + .should('not.have.class', 'disabled'); }); }); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
