Skip to content

🎥 Make videos programmatically with React

Internal: Add web renderer vector transform visual test (#10500)

Jonny Burger4614df995230
diff --git a/packages/web-renderer/src/test/Root.tsx b/packages/web-renderer/src/test/Root.tsx
index 9cf0ad9371..d7c13b594b 100644
--- a/packages/web-renderer/src/test/Root.tsx
+++ b/packages/web-renderer/src/test/Root.tsx
@@ -95,6 +95,7 @@ import {threeDoverflow} from './fixtures/three-d-overflow';
import {threeDTransformOpacity} from './fixtures/three-d-transform-opacity';
import {threeDTransformOutOfBounds} from './fixtures/three-d-transform-out-of-bounds';
import {threeLevelTransformOrigins} from './fixtures/three-level-transform-origins';
+import {issue10441TransformShorthands} from './fixtures/transforms/issue-10441-transform-shorthands';
import {orthographic} from './fixtures/transforms/orthographic';
import {transformWithAllShorthands} from './fixtures/transforms/transform-with-all-shorthands';
import {transformWithAxisRotate} from './fixtures/transforms/transform-with-axis-rotate';
@@ -205,6 +206,7 @@ export const Root: React.FC = () => {
<Composition {...orthographic} />
<Composition {...withMargin} />
<Composition {...withNegativeMargin} />
+ <Composition {...issue10441TransformShorthands} />
<Composition {...transformWithScale} />
<Composition {...transformWithMultiComponentScale} />
<Composition {...transformWithRotate} />
diff --git a/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-chromium-darwin.png b/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-chromium-darwin.png
new file mode 100644
index 0000000000..c31dd6ab3e
Binary files /dev/null and b/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-chromium-darwin.png differ
diff --git a/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-firefox-darwin.png b/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-firefox-darwin.png
new file mode 100644
index 0000000000..c979bebf93
Binary files /dev/null and b/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-firefox-darwin.png differ
diff --git a/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-webkit-darwin.png b/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-webkit-darwin.png
new file mode 100644
index 0000000000..5623c8aa4a
Binary files /dev/null and b/packages/web-renderer/src/test/__screenshots__/transform-shorthands.test.tsx/issue-10441-transform-shorthands-webkit-darwin.png differ
diff --git a/packages/web-renderer/src/test/fixtures/transforms/issue-10441-transform-shorthands.tsx b/packages/web-renderer/src/test/fixtures/transforms/issue-10441-transform-shorthands.tsx
new file mode 100644
index 0000000000..5138187761
--- /dev/null
+++ b/packages/web-renderer/src/test/fixtures/transforms/issue-10441-transform-shorthands.tsx
@@ -0,0 +1,79 @@
+import {AbsoluteFill} from 'remotion';
+
+const Component: React.FC = () => {
+ return (
+ <AbsoluteFill style={{backgroundColor: 'rgb(15, 23, 42)'}}>
+ <AbsoluteFill
+ style={{
+ width: 3132,
+ height: 2582,
+ translate: '-486.3px 18.4px',
+ rotate: '0.977622 -0.072309 -0.197554 36.030401deg',
+ scale: 1.177,
+ backgroundColor: 'rgb(226, 232, 240)',
+ }}
+ >
+ <div
+ style={{
+ position: 'absolute',
+ left: 0,
+ top: 0,
+ width: 600,
+ height: 600,
+ backgroundColor: 'rgb(239, 68, 68)',
+ }}
+ />
+ <div
+ style={{
+ position: 'absolute',
+ right: 0,
+ top: 0,
+ width: 600,
+ height: 600,
+ backgroundColor: 'rgb(59, 130, 246)',
+ }}
+ />
+ <div
+ style={{
+ position: 'absolute',
+ left: 0,
+ bottom: 0,
+ width: 600,
+ height: 600,
+ backgroundColor: 'rgb(34, 197, 94)',
+ }}
+ />
+ <div
+ style={{
+ position: 'absolute',
+ right: 0,
+ bottom: 0,
+ width: 600,
+ height: 600,
+ backgroundColor: 'rgb(234, 179, 8)',
+ }}
+ />
+ <div
+ style={{
+ position: 'absolute',
+ left: 1316,
+ top: 1041,
+ width: 500,
+ height: 500,
+ backgroundColor: 'rgb(168, 85, 247)',
+ borderRadius: '50%',
+ }}
+ />
+ </AbsoluteFill>
+ </AbsoluteFill>
+ );
+};
+
+export const issue10441TransformShorthands = {
+ component: Component,
+ id: 'issue-10441-transform-shorthands',
+ width: 2160,
+ height: 2160,
+ fps: 30,
+ durationInFrames: 1,
+} as const;
diff --git a/packages/web-renderer/src/test/transform-shorthands.test.tsx b/packages/web-renderer/src/test/transform-shorthands.test.tsx
index dea8cade0c..a894a434a5 100644
--- a/packages/web-renderer/src/test/transform-shorthands.test.tsx
+++ b/packages/web-renderer/src/test/transform-shorthands.test.tsx
@@ -2,6 +2,7 @@ import {test} from 'vitest';
import {page} from 'vitest/browser';
import {renderStillOnWeb} from '../render-still-on-web';
import '../symbol-dispose';
+import {issue10441TransformShorthands} from './fixtures/transforms/issue-10441-transform-shorthands';
import {transformWithAllShorthands} from './fixtures/transforms/transform-with-all-shorthands';
import {transformWithAxisRotate} from './fixtures/transforms/transform-with-axis-rotate';
import {transformWithMultiComponentScale} from './fixtures/transforms/transform-with-multi-component-scale';
@@ -10,6 +11,21 @@ import {transformWithScale} from './fixtures/transforms/transform-with-scale';
import {transformWithTranslate} from './fixtures/transforms/transform-with-translate';
import {testImage} from './utils';
+test('Should combine vector-axis rotate, translate, and scale shorthands', async () => {
+ await page.viewport(2160, 2160);
+
+ const blob = await (
+ await renderStillOnWeb({
+ licenseKey: 'free-license',
+ composition: issue10441TransformShorthands,
+ frame: 0,
+ inputProps: {},
+ })
+ ).blob({format: 'png'});
+
+ await testImage({blob, testId: 'issue-10441-transform-shorthands'});
+});
+
test('Should combine transform property with scale shorthand', async () => {
await page.viewport(1080, 1080);