Skip to content

Commit 17351bf

Browse files
fix: tests
1 parent de8fe21 commit 17351bf

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

apps/computer-vision/app/style_transfer/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export default function StyleTransferScreen() {
4444
const output = await model.forward(imageUri);
4545
const height = output.sizes[0];
4646
const width = output.sizes[1];
47-
// Native already returns RGBA uint8 — use directly
4847
const skData = Skia.Data.fromBytes(output.dataPtr);
4948
const img = Skia.Image.MakeImage(
5049
{

packages/react-native-executorch/common/rnexecutorch/tests/CMakeLists.txt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,11 @@ add_rn_test(BaseModelTests integration/BaseModelTest.cpp)
148148
add_rn_test(ClassificationTests integration/ClassificationTest.cpp
149149
SOURCES
150150
${RNEXECUTORCH_DIR}/models/classification/Classification.cpp
151+
${RNEXECUTORCH_DIR}/models/VisionModel.cpp
152+
${RNEXECUTORCH_DIR}/utils/FrameProcessor.cpp
153+
${RNEXECUTORCH_DIR}/utils/FrameExtractor.cpp
151154
${IMAGE_UTILS_SOURCES}
152-
LIBS opencv_deps
155+
LIBS opencv_deps android
153156
)
154157

155158
add_rn_test(ObjectDetectionTests integration/ObjectDetectionTest.cpp
@@ -167,8 +170,11 @@ add_rn_test(ImageEmbeddingsTests integration/ImageEmbeddingsTest.cpp
167170
SOURCES
168171
${RNEXECUTORCH_DIR}/models/embeddings/image/ImageEmbeddings.cpp
169172
${RNEXECUTORCH_DIR}/models/embeddings/BaseEmbeddings.cpp
173+
${RNEXECUTORCH_DIR}/models/VisionModel.cpp
174+
${RNEXECUTORCH_DIR}/utils/FrameProcessor.cpp
175+
${RNEXECUTORCH_DIR}/utils/FrameExtractor.cpp
170176
${IMAGE_UTILS_SOURCES}
171-
LIBS opencv_deps
177+
LIBS opencv_deps android
172178
)
173179

174180
add_rn_test(TextEmbeddingsTests integration/TextEmbeddingsTest.cpp
@@ -182,8 +188,11 @@ add_rn_test(TextEmbeddingsTests integration/TextEmbeddingsTest.cpp
182188
add_rn_test(StyleTransferTests integration/StyleTransferTest.cpp
183189
SOURCES
184190
${RNEXECUTORCH_DIR}/models/style_transfer/StyleTransfer.cpp
191+
${RNEXECUTORCH_DIR}/models/VisionModel.cpp
192+
${RNEXECUTORCH_DIR}/utils/FrameProcessor.cpp
193+
${RNEXECUTORCH_DIR}/utils/FrameExtractor.cpp
185194
${IMAGE_UTILS_SOURCES}
186-
LIBS opencv_deps
195+
LIBS opencv_deps android
187196
)
188197

189198
add_rn_test(VADTests integration/VoiceActivityDetectionTest.cpp
@@ -244,8 +253,10 @@ add_rn_test(OCRTests integration/OCRTest.cpp
244253
${RNEXECUTORCH_DIR}/models/ocr/utils/DetectorUtils.cpp
245254
${RNEXECUTORCH_DIR}/models/ocr/utils/RecognitionHandlerUtils.cpp
246255
${RNEXECUTORCH_DIR}/models/ocr/utils/RecognizerUtils.cpp
256+
${RNEXECUTORCH_DIR}/utils/FrameProcessor.cpp
257+
${RNEXECUTORCH_DIR}/utils/FrameExtractor.cpp
247258
${IMAGE_UTILS_SOURCES}
248-
LIBS opencv_deps
259+
LIBS opencv_deps android
249260
)
250261

251262
add_rn_test(VerticalOCRTests integration/VerticalOCRTest.cpp
@@ -258,6 +269,8 @@ add_rn_test(VerticalOCRTests integration/VerticalOCRTest.cpp
258269
${RNEXECUTORCH_DIR}/models/ocr/utils/DetectorUtils.cpp
259270
${RNEXECUTORCH_DIR}/models/ocr/utils/RecognitionHandlerUtils.cpp
260271
${RNEXECUTORCH_DIR}/models/ocr/utils/RecognizerUtils.cpp
272+
${RNEXECUTORCH_DIR}/utils/FrameProcessor.cpp
273+
${RNEXECUTORCH_DIR}/utils/FrameExtractor.cpp
261274
${IMAGE_UTILS_SOURCES}
262-
LIBS opencv_deps
275+
LIBS opencv_deps android
263276
)

packages/react-native-executorch/common/rnexecutorch/tests/integration/StyleTransferTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,18 @@ TEST(StyleTransferGenerateTests, MalformedURIThrows) {
6060
TEST(StyleTransferGenerateTests, ValidImageReturnsNonNull) {
6161
StyleTransfer model(kValidStyleTransferModelPath, nullptr);
6262
auto result = model.generateFromString(kValidTestImagePath);
63-
EXPECT_NE(result, nullptr);
63+
EXPECT_NE(result.dataPtr, nullptr);
64+
EXPECT_GT(result.width, 0);
65+
EXPECT_GT(result.height, 0);
6466
}
6567

6668
TEST(StyleTransferGenerateTests, MultipleGeneratesWork) {
6769
StyleTransfer model(kValidStyleTransferModelPath, nullptr);
6870
EXPECT_NO_THROW((void)model.generateFromString(kValidTestImagePath));
6971
auto result1 = model.generateFromString(kValidTestImagePath);
7072
auto result2 = model.generateFromString(kValidTestImagePath);
71-
EXPECT_NE(result1, nullptr);
72-
EXPECT_NE(result2, nullptr);
73+
EXPECT_NE(result1.dataPtr, nullptr);
74+
EXPECT_NE(result2.dataPtr, nullptr);
7375
}
7476

7577
TEST(StyleTransferInheritedTests, GetInputShapeWorks) {

0 commit comments

Comments
 (0)