feat: import Chinese-localized Buzz source snapshot
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Signed-off-by: cls_宁波本机 <908705107@qq.com>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:buzz/shared/emoji/emoji_data.dart';
|
||||
import 'package:buzz/shared/emoji/emoji_data_provider.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
/// Reads the committed asset straight off disk rather than through
|
||||
/// `rootBundle`, so this test guards the generated file itself — if
|
||||
/// `just mobile-emoji-data` ever emits a different shape, this fails.
|
||||
EmojiDataset _loadFromDisk() {
|
||||
final source = File(emojiDataAssetPath).readAsStringSync();
|
||||
return EmojiDataset.fromJson(jsonDecode(source) as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
void main() {
|
||||
late EmojiDataset dataset;
|
||||
|
||||
setUpAll(() {
|
||||
dataset = _loadFromDisk();
|
||||
});
|
||||
|
||||
test('parses every emoji-mart category in order', () {
|
||||
expect(dataset.categories.map((category) => category.id), [
|
||||
'people',
|
||||
'nature',
|
||||
'foods',
|
||||
'activity',
|
||||
'places',
|
||||
'objects',
|
||||
'symbols',
|
||||
'flags',
|
||||
]);
|
||||
});
|
||||
|
||||
test('carries the full standard set, not a hand-picked subset', () {
|
||||
// The hardcoded list this replaced had ~140 glyphs; emoji-mart ships ~1.9k.
|
||||
expect(dataset.all.length, greaterThan(1800));
|
||||
expect(
|
||||
dataset.all.length,
|
||||
dataset.categories.fold<int>(
|
||||
0,
|
||||
(total, category) => total + category.emoji.length,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('every entry has an id, a glyph, and a category', () {
|
||||
for (final entry in dataset.all) {
|
||||
expect(entry.id, isNotEmpty);
|
||||
expect(entry.native, isNotEmpty);
|
||||
expect(entry.categoryId, isNotEmpty);
|
||||
}
|
||||
});
|
||||
|
||||
test('resolves glyphs back to desktop-identical shortcodes', () {
|
||||
expect(dataset.nativeToShortcode['💯'], ':100:');
|
||||
expect(dataset.nativeToShortcode['🔥'], ':fire:');
|
||||
expect(dataset.nativeToShortcode['☝️'], ':point_up:');
|
||||
expect(dataset.nativeToShortcode['👍🏽'], ':+1:');
|
||||
expect(
|
||||
dataset.all
|
||||
.where((entry) => entry.id == '+1')
|
||||
.map((entry) => entry.native),
|
||||
containsAll(['👍', '👍🏻', '👍🏼', '👍🏽', '👍🏾', '👍🏿']),
|
||||
);
|
||||
});
|
||||
|
||||
test('displayName mirrors desktop emojiDisplayName', () {
|
||||
expect(dataset.displayName('🎉'), ':tada:');
|
||||
// Custom emoji already arrive as a shortcode and pass through untouched.
|
||||
expect(dataset.displayName(':party_parrot:'), ':party_parrot:');
|
||||
// Unknown glyphs fall back to themselves rather than a bogus name.
|
||||
expect(dataset.displayName('\u{1FAF6}\u{200D}\u{2764}'), isNotEmpty);
|
||||
});
|
||||
|
||||
test('empty dataset degrades safely', () {
|
||||
expect(EmojiDataset.empty.isEmpty, isTrue);
|
||||
expect(EmojiDataset.empty.displayName('🔥'), '🔥');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user