cypress_test/data/desktop/focus.odp                             |binary
 cypress_test/integration_tests/desktop/slide_operations_spec.js |   60 
++++++++++
 loleaflet/src/control/Control.PartsPreview.js                   |    3 
 3 files changed, 62 insertions(+), 1 deletion(-)

New commits:
commit 12ba5a3004549f739b576605ce7088be52264bc6
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Wed Apr 15 17:04:47 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Wed Apr 15 22:45:39 2020 +0200

    Add cypress test for slide operations
    
    Change-Id: I08d1c1f2fc6e6b1dab84040ce235dfbd6bbb59ec
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92280
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/cypress_test/data/desktop/focus.odp 
b/cypress_test/data/desktop/focus.odp
new file mode 100644
index 000000000..ffefc9e64
Binary files /dev/null and b/cypress_test/data/desktop/focus.odp differ
diff --git a/cypress_test/integration_tests/desktop/slide_operations_spec.js 
b/cypress_test/integration_tests/desktop/slide_operations_spec.js
new file mode 100644
index 000000000..3b135d44b
--- /dev/null
+++ b/cypress_test/integration_tests/desktop/slide_operations_spec.js
@@ -0,0 +1,60 @@
+/* global describe it cy require afterEach*/
+
+var helper = require('../common/helper');
+
+describe('Slide operations', function() {
+
+       afterEach(function() {
+               helper.afterAll('focus.odp');
+       });
+
+       function assertNumberOfSlides(slides) {
+               cy.get('.preview-frame')
+                       .should('have.length', slides + 1);
+       }
+
+       it('Add slides', function() {
+               helper.loadTestDoc('focus.odp');
+
+               cy.get('#tb_presentation-toolbar_item_insertpage')
+                       .should('not.have.class', 'disabled')
+                       .click();
+
+               assertNumberOfSlides(2);
+       });
+
+       it('Remove slides', function() {
+               helper.loadTestDoc('focus.odp');
+
+               // Add slides
+               cy.get('#tb_presentation-toolbar_item_insertpage')
+                       .should('not.have.class', 'disabled')
+                       .click();
+
+               assertNumberOfSlides(2);
+
+               // Remove Slides
+               cy.get('#tb_presentation-toolbar_item_deletepage')
+                       .should('not.have.class', 'disabled')
+                       .click();
+
+               cy.get('.vex-dialog-button-primary').click();
+
+               cy.get('#tb_presentation-toolbar_item_deletepage')
+                       .should('have.class', 'disabled');
+
+               assertNumberOfSlides(1);
+
+       });
+
+       it('Duplicate slide', function() {
+               helper.loadTestDoc('focus.odp');
+
+               cy.get('#tb_presentation-toolbar_item_duplicatepage')
+                       .should('not.have.class', 'disabled')
+                       .click();
+
+               assertNumberOfSlides(2);
+
+       });
+});
diff --git a/loleaflet/src/control/Control.PartsPreview.js 
b/loleaflet/src/control/Control.PartsPreview.js
index fb794fe32..045b9b01f 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -387,7 +387,8 @@ L.Control.PartsPreview = L.Control.extend({
                if (this._map.getDocType() === 'presentation' || 
this._map.getDocType() === 'drawing') {
                        if (!this._previewInitialized)
                                return;
-                       this._previewTiles[e.id].src = e.tile;
+                       if (this._previewTiles[e.id])
+                               this._previewTiles[e.id].src = e.tile;
                }
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to