private static String writeLayer(ZipOutputStream zos, int layerIndex, Layer layer)
      throws IOException {
    if (!(layer instanceof ImageLayer)) {
      return ""; // currently only image layers are supported
    }
    ImageLayer imageLayer = (ImageLayer) layer;

    String stackXML =
        String.format(
            Locale.ENGLISH,
            "<layer name=\"%s\" visibility=\"%s\" composite-op=\"%s\" opacity=\"%f\" src=\"data/%d.png\" x=\"%d\" y=\"%d\"/>\n",
            layer.getName(),
            layer.getVisibilityAsORAString(),
            layer.getBlendingMode().toSVGName(),
            layer.getOpacity(),
            layerIndex,
            imageLayer.getTranslationX(),
            imageLayer.getTranslationX());
    ZipEntry entry = new ZipEntry(String.format("data/%d.png", layerIndex));
    zos.putNextEntry(entry);
    BufferedImage image = imageLayer.getImage();
    ImageIO.write(image, "PNG", zos);
    zos.closeEntry();
    return stackXML;
  }
  private void testMoveToolImpl(boolean altDrag) {
    move(400, 400);
    click();
    if (altDrag) {
      altDrag(300, 300);
    } else {
      ImageLayer layer = ImageComponents.getActiveIC().getComp().getActiveImageLayerOrMask();
      int txx = layer.getTranslationX();
      int txy = layer.getTranslationY();
      assert txx == 0;
      assert txy == 0;

      drag(200, 300);

      txx = layer.getTranslationX();
      txy = layer.getTranslationY();

      // This will be true only if we are at 100% zoom!
      assert txx == -200 : "txx = " + txx;
      assert txy == -100 : "txy = " + txx;
    }
    keyboardUndoRedo();
    keyboardUndo();
  }