Files
Steam-Link-PS5/tests/test_demo_renderer.cpp
jmelovich ae52676cfc M0: boilerplate skeleton builds with the system clang and launches as PPSA99350
Imported ps5-native-app-boilerplate (Makefile, tools, tooling, clean-room runtime
builder, CPU demo renderer). The compiler wrapper and build.sh fall back to the
host clang when clang-18 is absent (Arch ships clang 22; verified), ccache is
optional, and the large home-screen DDS/AT9 assets stay out of git. Identity:
PPSA99350 "Steam Remote Play". Submodules pinned: ihslib master 1881b9a,
protobuf-c v1.5.2, mbedtls v3.6.4, opus v1.5.2 (the mbedtls/opus revisions
ProsperoLight proved on the console). ProsperoLight's sceNet socket adapter,
entropy source, mbedtls config and VideoDec2/VideoOut/AGC link stubs are staged
under platform/ps5 and vendor/ps5 for M1/M2.

Tested: make, make deploy, shsrv launch; the demo screen renders on the TV.
2026-10-08 17:12:01 -07:00

63 lines
1.6 KiB
C++

/*
* ps5-native-app-boilerplate - Host tests for reusable application behavior.
* Copyright (C) 2026 BlackBearReloaded
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Validates bounded asset loading without requiring PS5 hardware.
*/
#include "demo_renderer.hpp"
#include <gtest/gtest.h>
#include <array>
#include <cstdio>
#include <fstream>
#include <span>
namespace
{
class AssetTextTest : public testing::Test
{
protected:
static constexpr const char *missing_path = "build/tests/missing-banner.txt";
static constexpr const char *asset_path = "build/tests/banner.txt";
void SetUp() override
{
(void)std::remove(missing_path);
std::ofstream asset{asset_path, std::ios::binary};
ASSERT_TRUE(asset.is_open());
asset << "FROM APP0\r\n";
ASSERT_TRUE(asset.good());
}
void TearDown() override
{
(void)std::remove(asset_path);
(void)std::remove(missing_path);
}
};
TEST_F(AssetTextTest, MissingAssetUsesFallback)
{
std::array<char, 32> text{};
ps5::demo::read_asset_text(missing_path, std::span{text}, "FALLBACK");
EXPECT_STREQ(text.data(), "FALLBACK");
}
TEST_F(AssetTextTest, AssetTextTrimsLineEndings)
{
std::array<char, 32> text{};
ps5::demo::read_asset_text(asset_path, std::span{text}, "FALLBACK");
EXPECT_STREQ(text.data(), "FROM APP0");
}
TEST_F(AssetTextTest, AssetTextRemainsNullTerminatedWhenTruncated)
{
std::array<char, 5> bounded{};
ps5::demo::read_asset_text(asset_path, std::span{bounded}, "FALLBACK");
EXPECT_STREQ(bounded.data(), "FROM");
}
} // namespace