Started: 89.08% backend / 97.01% frontend lines.
Landed: 99.69% backend / 98.62% frontend.
Closed gaps targeted at logic gates, branches, and assumption boundaries
that real users hit. Each test exercises a use case the production code
actually serves; nothing here is line-padding.
Backend additions:
- DeviceModelTest: pin landscape vs portrait dimension swap, plus the
nativeWidth/Height "ignore orientation" contract the firmware relies on.
- DeviceApiControllerTest: validation branches the PWA forms can't
even produce (raw API misuse) — non-array wakeTimes, non-int entries,
invalid rotation mode, invalid timezone, empty name, invalid orientation,
other-user PATCH returns 404. Plus full /preview coverage: 404 for
other-user / no-current / no-asset / missing-file / soft-deleted, and
happy paths for landscape AND portrait (the rotateImage(90) branch).
- ImageApiControllerTest: cropOrientation now exercised on both upload
and reprocess paths.
- TokenActionControllerTest: TK-01c covers the bad-device-id "continue"
branch in submit.
- RenderImageMessageHandlerTest: explicit portrait test pins the
rotateImage(-90) branch and the 192,000-byte EPD-native bin shape.
- SeedFakeDevicesCommandTest: 4 cases covering missing-user, fresh
create, idempotent re-run, and --remove path. The dev seed command
is load-bearing for the multi-frame UI; a silent break would surface
a week later.
- RerenderAssetsCommandTest: reset + dispatch path, no-assets path.
Frontend additions:
- FrameCardTest: lastSync-only and nextSync-only rendering branches.
- HomeView.test:
* + Add time fallback path when all 9 default candidates are taken.
* Multi-day "in Nd" nextSync formatting (offline / huge-interval case).
* Medium-horizon (5h) nextSync formats as clock-time + day label.
* visibilitychange triggers a silent re-fetch.
* add-photo handler creates input + navigates to /upload after pick.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Unit\Enum;
|
||||
|
||||
use App\Enum\DeviceModel;
|
||||
use App\Enum\Orientation;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* width()/height() must follow orientation, but nativeWidth()/nativeHeight()
|
||||
* are the EPD's hardware scan dimensions and must NOT depend on orientation
|
||||
* (the renderer pre-rotates portrait images and streams raw bytes).
|
||||
*/
|
||||
class DeviceModelTest extends TestCase
|
||||
{
|
||||
public function test_v1_landscape_dimensions_are_800x480(): void
|
||||
{
|
||||
$this->assertSame(800, DeviceModel::V1->width(Orientation::Landscape));
|
||||
$this->assertSame(480, DeviceModel::V1->height(Orientation::Landscape));
|
||||
}
|
||||
|
||||
public function test_v1_portrait_dimensions_are_swapped(): void
|
||||
{
|
||||
$this->assertSame(480, DeviceModel::V1->width(Orientation::Portrait));
|
||||
$this->assertSame(800, DeviceModel::V1->height(Orientation::Portrait));
|
||||
}
|
||||
|
||||
public function test_native_dimensions_ignore_orientation(): void
|
||||
{
|
||||
// The firmware streams 800x480 EPD-native rows regardless of how the
|
||||
// photo was framed; renderer rotates the input photo, then writes in
|
||||
// EPD scan order.
|
||||
$this->assertSame(800, DeviceModel::V1->nativeWidth());
|
||||
$this->assertSame(480, DeviceModel::V1->nativeHeight());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user