Files
buzz/mobile/test/shared/animated_avatar_test.dart
klopez4212 a0298539f7 Add mobile profile editing (#6583)
## Summary

- add mobile editing for display name, profile description, and profile
photo
- support image positioning, emoji backgrounds, and animated avatar
capture with native iOS controls
- refine settings navigation, profile motion, and the connection
identity row

## Testing

- `just mobile-check`
- `just mobile-test` (1,685 tests)

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Kenny Lopez <klopez4212@gmail.com>
Co-authored-by: Carl <3c4caeafb646d23867f1c4832e68211d77e2561946171625f75c3ce1a3f2670f@buzz.block.builderlab.xyz>
2026-08-24 20:26:28 +01:00

44 lines
1.4 KiB
Dart

import 'package:buzz/shared/animated_avatar.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
const posterUrl = 'https://relay.example/media/poster.png';
const animationUrl = 'https://relay.example/media/animation.png?loop=1';
test('parses the selected poster and animated PNG URLs', () {
final url = buildAnimatedAvatarUrl(posterUrl, animationUrl);
final parsed = parseAnimatedAvatarUrl(url);
expect(parsed?.posterUrl, posterUrl);
expect(parsed?.animationUrl, animationUrl);
});
test('builds the shared desktop and mobile fragment format', () {
expect(
buildAnimatedAvatarUrl(posterUrl, animationUrl),
'$posterUrl#buzz-anim=${Uri.encodeComponent(animationUrl)}',
);
});
test('rejects malformed and non-http animated avatar URLs', () {
expect(parseAnimatedAvatarUrl(posterUrl), isNull);
expect(parseAnimatedAvatarUrl('$posterUrl#buzz-anim='), isNull);
expect(parseAnimatedAvatarUrl('$posterUrl#buzz-anim=%E0%A4%A'), isNull);
expect(parseAnimatedAvatarUrl('$posterUrl#buzz-anim=%'), isNull);
expect(
parseAnimatedAvatarUrl(
'$posterUrl#buzz-anim=${Uri.encodeComponent('javascript:alert(1)')}',
),
isNull,
);
expect(
parseAnimatedAvatarUrl(
'data:image/png;base64,xx#buzz-anim='
'${Uri.encodeComponent(animationUrl)}',
),
isNull,
);
});
}