mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-05 10:37:48 +00:00
ci: small avatars for the smoke test's directory entries, and a channel for it to join
ci_group and ci_channel get 64 px avatars from avatar.swift (a new side argument), small enough that both still arrive in one directory response; the backend's search probe fails if they do not, and the page sizes go to seed.md. The new channel ci_cards ("ci cards", also with a small avatar) is for the smoke test to join, so that the chat list shows its cards; no Claude case uses it.
This commit is contained in:
1 parent
783fb8882b
commit
ba194afa98
2 files changed
+15
-8
No files matched your search
@@ -2,7 +2,7 @@
|
||||
// a JPEG at quality 0.85 drawn at scale 1, shrunk by sqrt(size / 12500), at most halved per step,
|
||||
// until its data URI is at most 12500 characters. The picture is synthetic and photo-like: a gradient,
|
||||
// discs and noise, with more noise for a higher detail.
|
||||
// Usage: avatar <seed> <detail 0...1> <output file>
|
||||
// Usage: avatar <seed> <detail 0...1> <output file> [side in pixels, default 1024]
|
||||
|
||||
import CoreGraphics
|
||||
import Foundation
|
||||
@@ -70,12 +70,12 @@ func reduced(_ image: CGImage, ratio: Double) -> CGImage {
|
||||
}
|
||||
|
||||
let args = CommandLine.arguments
|
||||
guard args.count == 4, let seed = UInt64(args[1]), let detail = Double(args[2]) else {
|
||||
print("usage: avatar <seed> <detail 0...1> <output file>")
|
||||
guard args.count == 4 || args.count == 5, let seed = UInt64(args[1]), let detail = Double(args[2]), let side = Int(args.count == 5 ? args[4] : "1024") else {
|
||||
print("usage: avatar <seed> <detail 0...1> <output file> [side in pixels, default 1024]")
|
||||
exit(1)
|
||||
}
|
||||
var generator = Random(state: seed)
|
||||
var image = picture(side: 1024, detail: detail, random: &generator)
|
||||
var image = picture(side: side, detail: detail, random: &generator)
|
||||
var uri = jpegDataURI(image)
|
||||
var steps = 0
|
||||
while uri.count > maxDataSize {
|
||||
|
||||
@@ -224,13 +224,17 @@ new_address() {
|
||||
esac
|
||||
}
|
||||
|
||||
# Avatars at the size the app makes them (avatar.swift), with different amounts of detail.
|
||||
# Avatars at the size the app makes them (avatar.swift), with different amounts of detail;
|
||||
# and small ones for the smoke test's entries, so that its two search results still arrive in one response.
|
||||
make_avatars() {
|
||||
xcrun swiftc -O -o "$work/avatar" "$(dirname "$0")/avatar.swift"
|
||||
local i
|
||||
for i in 1 2 3 4 5 6; do
|
||||
"$work/avatar" "$i" "0.$((i + 2))" "$work/avatar-$i.txt"
|
||||
done
|
||||
for i in 7 8 9; do
|
||||
"$work/avatar" "$i" 0 "$work/avatar-$i.txt" 64
|
||||
done
|
||||
}
|
||||
|
||||
seed_avatars() {
|
||||
@@ -402,7 +406,8 @@ write_seed() {
|
||||
echo
|
||||
echo "| Search with | Entries | Seeded for |"
|
||||
echo "|---|---|---|"
|
||||
echo "| \`$search_text\` | ci_group (group, no avatar), ci_channel (channel, no avatar) | the smoke test; results on one page |"
|
||||
echo "| \`$search_text\` | ci_group (group), ci_channel (channel), each with a small avatar (64 px) | the smoke test; results on one page |"
|
||||
echo "| \`ci cards\` | ci_cards (channel, with a small avatar) | the smoke test joins it, so that the chat list shows its cards |"
|
||||
echo "| \`$avatar_search_text\` | ci_avatar_g1…3 (groups), ci_avatar_c1…3 (channels), each with an avatar the size the app makes | avatars and the response size limit: about one entry per page |"
|
||||
echo "| \`ci long\` | $long_name (group): a long name and a two-line description | D3 |"
|
||||
echo "| \`ci markdown\` | ci_markdown (group): markdown in the description | D5 |"
|
||||
@@ -446,9 +451,10 @@ start() {
|
||||
start_directory "0:nobody"
|
||||
trap dump_directory EXIT
|
||||
connect_admin
|
||||
seed_group ci_group "CI seed group"
|
||||
seed_group ci_group "CI seed group" "$work/avatar-7.txt"
|
||||
setup_relay
|
||||
seed_channel ci_channel "CI seed channel"
|
||||
seed_channel ci_channel "CI seed channel" "$work/avatar-8.txt"
|
||||
seed_channel ci_cards "CI cards channel" "$work/avatar-9.txt"
|
||||
seed_avatars
|
||||
seed_group "$long_name" "CI long entry: a description long enough to take two lines in the directory results, to check how the row truncates"
|
||||
seed_group ci_markdown "CI markdown *bold* _italic_ [x](https://example.com)"
|
||||
@@ -456,6 +462,7 @@ start() {
|
||||
probe_search
|
||||
probe_names
|
||||
write_seed
|
||||
probe_pages "$search_text" 2
|
||||
probe_pages "$avatar_search_text" 6
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user