Source:
<code>public void testRecomputePictureViews() throws Exception { DocumentModel doc = session.createDocumentModel("/", "pictureDoc", "Picture"); Blob blob = Blobs.createBlob(FileUtils.getResourceFileFromContext("images/test.jpg"), "image/jpeg", StandardCharsets.UTF_8.name(), "test.jpg"); doc.setPropertyValue("file:content", (Serializable) blob); doc = session.createDocument(doc); txFeature.nextTransaction(); doc = session.getDocument(doc.getRef()); List<Serializable> pictureViews = (List<Serializable>) doc.getPropertyValue("picture:views"); assertNotNull(pictureViews); assertFalse(pictureViews.isEmpty()); MultiviewPicture multiviewPicture = doc.getAdapter(MultiviewPicture.class); PictureView picView = multiviewPicture.getView("Medium"); ImageInfo imageBlobInfo = imagingService.getImageInfo(picView.getBlob()); ImageInfo resizedImageInfo = picView.getImageInfo(); assertEquals(imageBlobInfo.getHeight(), resizedImageInfo.getHeight()); assertEquals(imageBlobInfo.getWidth(), resizedImageInfo.getWidth()); assertEquals(imageBlobInfo.getWidth(), picView.getWidth()); <START> assertEquals(imageBlobInfo.getHeight(), resizedImageInfo.getHeight()); <END> doc.setPropertyValue("picture:views", new ArrayList<>()); session.saveDocument(doc); txFeature.nextTransaction(); doc = session.getDocument(doc.getRef()); pictureViews = (List<Serializable>) doc.getPropertyValue("picture:views"); assertNotNull(pictureViews); assertTrue(pictureViews.isEmpty()); Map<String, String> parameters = Collections.singletonMap("query", "SELECT * FROM Document WHERE ecm:mixinType = 'Picture'"); try (OperationContext ctx = new OperationContext(session)) { automationService.run(ctx, RecomputePictureViews.ID, parameters); } txFeature.nextTransaction(); doc = session.getDocument(doc.getRef()); pictureViews = (List<Serializable>) doc.getPropertyValue("picture:views"); assertNotNull(pictureViews); assertFalse(pictureViews.isEmpty()); }</code><technical_language>line want check picView height right</technical_language>

Target:
public void testRecomputePictureViews() throws Exception { DocumentModel doc = session.createDocumentModel("/", "pictureDoc", "Picture"); Blob blob = Blobs.createBlob(FileUtils.getResourceFileFromContext("images/test.jpg"), "image/jpeg", StandardCharsets.UTF_8.name(), "test.jpg"); doc.setPropertyValue("file:content", (Serializable) blob); doc = session.createDocument(doc); txFeature.nextTransaction(); doc = session.getDocument(doc.getRef()); List<Serializable> pictureViews = (List<Serializable>) doc.getPropertyValue("picture:views"); assertNotNull(pictureViews); assertFalse(pictureViews.isEmpty()); doc.setPropertyValue("picture:views", new ArrayList<>()); session.saveDocument(doc); txFeature.nextTransaction(); doc = session.getDocument(doc.getRef()); pictureViews = (List<Serializable>) doc.getPropertyValue("picture:views"); assertNotNull(pictureViews); assertTrue(pictureViews.isEmpty()); Map<String, String> parameters = Collections.singletonMap("query", "SELECT * FROM Document WHERE ecm:mixinType = 'Picture'"); try (OperationContext ctx = new OperationContext(session)) { automationService.run(ctx, RecomputePictureViews.ID, parameters); } txFeature.nextTransaction(); doc = session.getDocument(doc.getRef()); pictureViews = (List<Serializable>) doc.getPropertyValue("picture:views"); assertNotNull(pictureViews); assertFalse(pictureViews.isEmpty()); }