@Test public void testRemoveImage() { final Site site = TestUtil.createSite(); TestUtil.createUserAndUserOnSiteRightAndLogin(site, SiteAccessLevel.ADMINISTRATOR); final DraftSlideShow slideShow = TestUtil.createSlideShow(site); final SlideShowImage slideShowImage = TestUtil.createSlideShowImage(slideShow); slideShowImage.setPosition(1); service.removeImage(slideShowImage.getSlideShowImageId()); Assert.assertEquals(0, slideShow.getImages().size()); }
@Test public void testMoveImageLeftWithFirstImage() { final Site site = TestUtil.createSite(); TestUtil.createUserAndUserOnSiteRightAndLogin(site, SiteAccessLevel.ADMINISTRATOR); final DraftSlideShow slideShow = TestUtil.createSlideShow(site); final SlideShowImage slideShowImage1 = TestUtil.createSlideShowImage(slideShow); slideShowImage1.setPosition(0); final SlideShowImage slideShowImage2 = TestUtil.createSlideShowImage(slideShow); slideShowImage2.setPosition(12); final SlideShowImage slideShowImage3 = TestUtil.createSlideShowImage(slideShow); slideShowImage3.setPosition(54); final SlideShowImage slideShowImage4 = TestUtil.createSlideShowImage(slideShow); slideShowImage4.setPosition(155); final SlideShowImage slideShowImage5 = TestUtil.createSlideShowImage(slideShow); slideShowImage5.setPosition(351); service.moveImageLeft(slideShowImage1.getSlideShowImageId()); Assert.assertEquals(5, slideShow.getImages().size()); Assert.assertEquals(0, slideShowImage1.getPosition()); Assert.assertEquals(12, slideShowImage2.getPosition()); Assert.assertEquals(54, slideShowImage3.getPosition()); Assert.assertEquals(155, slideShowImage4.getPosition()); Assert.assertEquals(351, slideShowImage5.getPosition()); }