Skip to content

Commit

Permalink
tests: Add a visual test for equivalence of blur quality/repetition a…
Browse files Browse the repository at this point in the history
…nd filters/applyFilter
  • Loading branch information
torokati44 authored and Dinnerbone committed Jul 26, 2023
1 parent 5f840bf commit 9fa3a11
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 0 deletions.
99 changes: 99 additions & 0 deletions tests/tests/swfs/visual/filters/blur_pass_scaling_test/Test.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package {

import flash.display.Bitmap;
import flash.geom.Point;
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.display.MovieClip;
import flash.filters.BlurFilter;


public class Test extends MovieClip {

private static const BLURSIZE = 7;

function row_1() {

for (var quality = 0; quality < 10; quality += 1) {
var image : BitmapData = new Image();

var filter = new BlurFilter(BLURSIZE, 1, quality);
image.applyFilter(image, new Rectangle(0, 0, 80, 80), new Point(0, 0), filter); // applied only once

var bm = new Bitmap(image);
bm.smoothing = false;
bm.y = 10;
bm.x = quality * 100 + 10;
addChild(bm);
}
}

function row_2() {

for (var applications = 0; applications < 10; applications += 1) {
var image : BitmapData = new Image();

var filter = new BlurFilter(BLURSIZE, 1, 1); // quality is always 1
for (var i = 0; i < applications; ++i)
image.applyFilter(image, new Rectangle(0, 0, 80, 80), new Point(0, 0), filter);

var bm = new Bitmap(image);
bm.smoothing = false;
bm.y = 110;
bm.x = i * 100 + 10;
addChild(bm);
}
}


function row_3() {

for (var quality = 0; quality < 10; quality += 1) {
var image : BitmapData = new Image();

var filter = new BlurFilter(BLURSIZE, 1, quality);

var bm = new Bitmap(image);
bm.smoothing = false;
bm.y = 210;
bm.x = quality * 100 + 10;
bm.filters = [filter]; // applied only once
addChild(bm);
}
}


function row_4() {

for (var applications = 0; applications < 10; applications += 1) {
var image : BitmapData = new Image();

var filter = new BlurFilter(BLURSIZE, 1, 1); // quality is always 1

var filters = [];

for (var i = 0; i < applications; ++i)
filters.push(filter);

var bm = new Bitmap(image);
bm.smoothing = false;
bm.y = 310;
bm.x = i * 100 + 10;
bm.filters = filters;
addChild(bm);
}
}

public function Test() {

row_1();
row_2();
row_3();
row_4();



}
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
num_frames = 1

[image_comparison]
tolerance = 3

[player_options]
with_renderer = { optional = false, sample_count = 1 }

0 comments on commit 9fa3a11

Please sign in to comment.