Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Watch screenshots: the synthetic clip as a GIF, as the phone sends it

Duarte Santos672bac28b3eb
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
index d678ad4ce..924420108 100644
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@ -130,10 +130,11 @@ jobs:
xcrun simctl bootstatus "$UDID" -b
xcrun simctl install "$UDID" "$APP"
# A synthetic clip (a square moving, made with ffmpeg for the tests; no exercise media)
- # in the app's own container, to show the animation path renders.
+ # in the app's own container, to show the animation path renders: a GIF, as the phone
+ # sends it (the watch decodes what WatchBridgePlugin made, never WebP itself).
DATA=$(xcrun simctl get_app_container "$UDID" ch.opengym.app.watchkitapp data 2>/dev/null || true)
CLIP=""
- if [ -n "$DATA" ]; then mkdir -p "$DATA/tmp" && cp WatchCore/Tests/WatchCoreTests/Fixtures/synthetic-square.webp "$DATA/tmp/clip.webp" && CLIP="$DATA/tmp/clip.webp"; fi
+ if [ -n "$DATA" ]; then mkdir -p "$DATA/tmp" && cp WatchCore/Tests/WatchCoreTests/Fixtures/synthetic-square.gif "$DATA/tmp/clip.gif" && CLIP="$DATA/tmp/clip.gif"; fi
for screen in idle empty set weight rest finish; do
xcrun simctl terminate "$UDID" ch.opengym.app.watchkitapp 2>/dev/null || true
if [ "$screen" = set ] && [ -n "$CLIP" ]; then
diff --git a/frontend/ios/App/WatchCore/Tests/WatchCoreTests/ClipCodecTests.swift b/frontend/ios/App/WatchCore/Tests/WatchCoreTests/ClipCodecTests.swift
index 5f5809303..e90ab9783 100644
--- a/frontend/ios/App/WatchCore/Tests/WatchCoreTests/ClipCodecTests.swift
+++ b/frontend/ios/App/WatchCore/Tests/WatchCoreTests/ClipCodecTests.swift
@@ -36,6 +36,15 @@ final class ClipCodecTests: XCTestCase {
XCTAssertGreaterThan(try XCTUnwrap(ClipCodec.decode(out)).images.count, 5)
}
+ /// What the watch gets (and what CI's watch screenshots show): Fixtures/synthetic-square.gif,
+ /// the same moving square as a GIF, as the phone sends it.
+ func testTheWatchReadsAGifAsThePhoneSendsIt() throws {
+ let gif = try XCTUnwrap(Bundle.module.url(forResource: "synthetic-square", withExtension: "gif", subdirectory: "Fixtures"))
+ let frames = try XCTUnwrap(ClipCodec.decode(gif))
+ XCTAssertEqual(frames.images.count, 12)
+ XCTAssertEqual(frames.duration, 1.2, accuracy: 0.25)
+ }
+
func testSomethingThatIsNotAnImageGivesNothing() throws {
let junk = FileManager.default.temporaryDirectory.appendingPathComponent("junk-\(UUID().uuidString).webp")
try Data("not an image".utf8).write(to: junk)
diff --git a/frontend/ios/App/WatchCore/Tests/WatchCoreTests/Fixtures/synthetic-square.gif b/frontend/ios/App/WatchCore/Tests/WatchCoreTests/Fixtures/synthetic-square.gif
new file mode 100644
index 000000000..81e1d11b0
Binary files /dev/null and b/frontend/ios/App/WatchCore/Tests/WatchCoreTests/Fixtures/synthetic-square.gif differ