Effect: Add leading zero to decimals in floats.

PiperOrigin-RevId: 509518734
This commit is contained in:
huangdarwin 2023-02-14 15:09:58 +00:00 committed by christosts
parent 20eae0e041
commit b7d68fb62e
3 changed files with 6 additions and 6 deletions

View File

@ -116,7 +116,7 @@ public final class CropPixelTest {
public void drawFrame_cropSmaller_matchesGoldenFile() throws Exception { public void drawFrame_cropSmaller_matchesGoldenFile() throws Exception {
String testId = "drawFrame_cropSmaller"; String testId = "drawFrame_cropSmaller";
cropShaderProgram = cropShaderProgram =
new Crop(/* left= */ -.9f, /* right= */ .1f, /* bottom= */ -1f, /* top= */ .5f) new Crop(/* left= */ -0.9f, /* right= */ 0.1f, /* bottom= */ -1f, /* top= */ 0.5f)
.toGlShaderProgram(context, /* useHdr= */ false); .toGlShaderProgram(context, /* useHdr= */ false);
Size outputSize = cropShaderProgram.configure(inputWidth, inputHeight); Size outputSize = cropShaderProgram.configure(inputWidth, inputHeight);
setupOutputTexture(outputSize.getWidth(), outputSize.getHeight()); setupOutputTexture(outputSize.getWidth(), outputSize.getHeight());

View File

@ -48,9 +48,9 @@ public final class CropTest {
public void configure_setCrop_changesDimensions() { public void configure_setCrop_changesDimensions() {
int inputWidth = 300; int inputWidth = 300;
int inputHeight = 200; int inputHeight = 200;
float left = -.5f; float left = -0.5f;
float right = .5f; float right = 0.5f;
float bottom = .5f; float bottom = 0.5f;
float top = 1f; float top = 1f;
Crop crop = new Crop(left, right, bottom, top); Crop crop = new Crop(left, right, bottom, top);

View File

@ -52,14 +52,14 @@ public final class ScaleToFitTransformationTest {
int inputHeight = 150; int inputHeight = 150;
ScaleToFitTransformation scaleToFitTransformation = ScaleToFitTransformation scaleToFitTransformation =
new ScaleToFitTransformation.Builder() new ScaleToFitTransformation.Builder()
.setScale(/* scaleX= */ .5f, /* scaleY= */ 1f) .setScale(/* scaleX= */ 0.5f, /* scaleY= */ 1f)
.build(); .build();
Size outputSize = scaleToFitTransformation.configure(inputWidth, inputHeight); Size outputSize = scaleToFitTransformation.configure(inputWidth, inputHeight);
boolean isNoOp = scaleToFitTransformation.isNoOp(inputWidth, inputHeight); boolean isNoOp = scaleToFitTransformation.isNoOp(inputWidth, inputHeight);
assertThat(isNoOp).isFalse(); assertThat(isNoOp).isFalse();
assertThat(outputSize.getWidth()).isEqualTo(Math.round(inputWidth * .5f)); assertThat(outputSize.getWidth()).isEqualTo(Math.round(inputWidth * 0.5f));
assertThat(outputSize.getHeight()).isEqualTo(inputHeight); assertThat(outputSize.getHeight()).isEqualTo(inputHeight);
} }