| 1 |
/* |
| 2 |
* Created on 18 JAN 2017 |
| 3 |
* Copyright 2015 by Andrea Vacondio ([email protected]). |
| 4 |
* This file is part of Sejda. |
| 5 |
* |
| 6 |
* Sejda is free software: you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU Affero General Public License as published by |
| 8 |
* the Free Software Foundation, either version 3 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* Sejda is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU Affero General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Affero General Public License |
| 17 |
* along with Sejda. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
package org.sejda.impl.sambox.util; |
| 20 |
|
| 21 |
import static org.junit.Assert.assertEquals; |
| 22 |
|
| 23 |
import org.junit.Test; |
| 24 |
import org.sejda.model.pdf.transition.PdfPageTransition; |
| 25 |
import org.sejda.model.pdf.transition.PdfPageTransitionStyle; |
| 26 |
import org.sejda.sambox.pdmodel.interactive.pagenavigation.PDTransition; |
| 27 |
|
| 28 |
public class TransitionUtilsTest { |
| 29 |
|
| 30 |
@Test |
| 31 |
public void testInitTransitionMotionBoxInward() { |
| 32 |
PDTransition to = new PDTransition(); |
| 33 |
TransitionUtils.initTransitionMotion(PdfPageTransition.newInstance(PdfPageTransitionStyle.BOX_INWARD, 2, 2), |
| 34 |
to); |
| 35 |
assertEquals("I", to.getMotion()); |
| 36 |
} |
| 37 |
|
| 38 |
@Test |
| 39 |
public void testInitTransitionMotionSplitHorizontalInward() { |
| 40 |
PDTransition to = new PDTransition(); |
| 41 |
TransitionUtils.initTransitionMotion( |
| 42 |
PdfPageTransition.newInstance(PdfPageTransitionStyle.SPLIT_HORIZONTAL_INWARD, 2, 2), to); |
| 43 |
assertEquals("I", to.getMotion()); |
| 44 |
} |
| 45 |
|
| 46 |
@Test |
| 47 |
public void testInitTransitionMotionSplitVerticalInward() { |
| 48 |
PDTransition to = new PDTransition(); |
| 49 |
TransitionUtils.initTransitionMotion( |
| 50 |
PdfPageTransition.newInstance(PdfPageTransitionStyle.SPLIT_VERTICAL_INWARD, 2, 2), to); |
| 51 |
assertEquals("I", to.getMotion()); |
| 52 |
} |
| 53 |
|
| 54 |
@Test |
| 55 |
public void testInitTransitionMotionBoxOnward() { |
| 56 |
PDTransition to = new PDTransition(); |
| 57 |
TransitionUtils.initTransitionMotion(PdfPageTransition.newInstance(PdfPageTransitionStyle.BOX_OUTWARD, 2, 2), |
| 58 |
to); |
| 59 |
assertEquals("O", to.getMotion()); |
| 60 |
} |
| 61 |
|
| 62 |
@Test |
| 63 |
public void testInitTransitionMotionSplitHorizontalOnward() { |
| 64 |
PDTransition to = new PDTransition(); |
| 65 |
TransitionUtils.initTransitionMotion( |
| 66 |
PdfPageTransition.newInstance(PdfPageTransitionStyle.SPLIT_HORIZONTAL_OUTWARD, 2, 2), to); |
| 67 |
assertEquals("O", to.getMotion()); |
| 68 |
} |
| 69 |
|
| 70 |
@Test |
| 71 |
public void testInitTransitionMotionSplitVerticalOnward() { |
| 72 |
PDTransition to = new PDTransition(); |
| 73 |
TransitionUtils.initTransitionMotion( |
| 74 |
PdfPageTransition.newInstance(PdfPageTransitionStyle.SPLIT_VERTICAL_OUTWARD, 2, 2), to); |
| 75 |
assertEquals("O", to.getMotion()); |
| 76 |
} |
| 77 |
|
| 78 |
@Test |
| 79 |
public void testInitTransitionDefault() { |
| 80 |
PDTransition to = new PDTransition(); |
| 81 |
TransitionUtils.initTransitionMotion(PdfPageTransition.newInstance(PdfPageTransitionStyle.FADE, 2, 2), to); |
| 82 |
assertEquals("I", to.getMotion()); |
| 83 |
} |
| 84 |
|
| 85 |
} |