132 lines
4.9 KiB
C++
132 lines
4.9 KiB
C++
|
|
#include "TestFramework.h"
|
||
|
|
#include <android/log.h>
|
||
|
|
#include <jni.h>
|
||
|
|
#include <cstdlib>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
// Forward declarations for test registration functions
|
||
|
|
namespace VavCoreTest {
|
||
|
|
void RegisterOpenGLESTextureTests(TestFramework& framework);
|
||
|
|
void RegisterVulkanImageTests(TestFramework& framework);
|
||
|
|
}
|
||
|
|
|
||
|
|
int main(int argc, char* argv[]) {
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "=== VavCore Texture Binding Test Application ===");
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Starting comprehensive OpenGL ES and Vulkan texture binding tests");
|
||
|
|
|
||
|
|
// Create test framework
|
||
|
|
VavCoreTest::TestFramework framework;
|
||
|
|
|
||
|
|
// Register all test suites
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Registering OpenGL ES texture tests...");
|
||
|
|
VavCoreTest::RegisterOpenGLESTextureTests(framework);
|
||
|
|
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Registering Vulkan image tests...");
|
||
|
|
VavCoreTest::RegisterVulkanImageTests(framework);
|
||
|
|
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "All tests registered successfully");
|
||
|
|
|
||
|
|
// Check for specific test name argument
|
||
|
|
bool run_all = true;
|
||
|
|
std::string specific_test;
|
||
|
|
|
||
|
|
if (argc > 1) {
|
||
|
|
specific_test = argv[1];
|
||
|
|
run_all = false;
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Running specific test: %s", specific_test.c_str());
|
||
|
|
} else {
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Running all tests");
|
||
|
|
}
|
||
|
|
|
||
|
|
// Run tests
|
||
|
|
bool all_passed = false;
|
||
|
|
|
||
|
|
if (run_all) {
|
||
|
|
all_passed = framework.RunAllTests();
|
||
|
|
} else {
|
||
|
|
all_passed = framework.RunTest(specific_test);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Print final results
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "=== Final Test Results ===");
|
||
|
|
|
||
|
|
if (run_all) {
|
||
|
|
auto results = framework.GetResults();
|
||
|
|
int total_tests = static_cast<int>(results.size());
|
||
|
|
int passed_tests = 0;
|
||
|
|
|
||
|
|
for (const auto& result : results) {
|
||
|
|
if (result.passed) {
|
||
|
|
passed_tests++;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Total tests run: %d", total_tests);
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Tests passed: %d", passed_tests);
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Tests failed: %d", total_tests - passed_tests);
|
||
|
|
|
||
|
|
if (total_tests > 0) {
|
||
|
|
double success_rate = (static_cast<double>(passed_tests) / total_tests) * 100.0;
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Success rate: %.1f%%", success_rate);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if (all_passed) {
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "🎉 All tests PASSED!");
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "OpenGL ES and Vulkan texture binding implementation is working correctly");
|
||
|
|
} else {
|
||
|
|
__android_log_print(ANDROID_LOG_ERROR, "VavCoreTextureTest", "❌ Some tests FAILED!");
|
||
|
|
__android_log_print(ANDROID_LOG_ERROR, "VavCoreTextureTest", "Please check the logs above for detailed error information");
|
||
|
|
}
|
||
|
|
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "=== VavCore Texture Binding Test Complete ===");
|
||
|
|
|
||
|
|
// Return appropriate exit code
|
||
|
|
return all_passed ? EXIT_SUCCESS : EXIT_FAILURE;
|
||
|
|
}
|
||
|
|
|
||
|
|
// Additional utility functions for Android environment
|
||
|
|
|
||
|
|
extern "C" {
|
||
|
|
|
||
|
|
// JNI function for running tests from Java (if needed)
|
||
|
|
JNIEXPORT jint JNICALL
|
||
|
|
Java_com_vavcore_texturetest_MainActivity_runNativeTests(JNIEnv *env, jobject thiz) {
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Running tests from JNI call");
|
||
|
|
|
||
|
|
// Store JavaVM for decoder usage
|
||
|
|
JavaVM* jvm;
|
||
|
|
env->GetJavaVM(&jvm);
|
||
|
|
|
||
|
|
// Run main test function
|
||
|
|
char* dummy_argv[] = { const_cast<char*>("VavCoreTextureBindingTest") };
|
||
|
|
int result = main(1, dummy_argv);
|
||
|
|
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "JNI test execution completed with result: %d", result);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
// JNI function for running specific test from Java
|
||
|
|
JNIEXPORT jint JNICALL
|
||
|
|
Java_com_vavcore_texturetest_MainActivity_runSpecificTest(JNIEnv *env, jobject thiz, jstring test_name) {
|
||
|
|
const char* test_name_str = env->GetStringUTFChars(test_name, nullptr);
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "Running specific test from JNI: %s", test_name_str);
|
||
|
|
|
||
|
|
// Store JavaVM for decoder usage
|
||
|
|
JavaVM* jvm;
|
||
|
|
env->GetJavaVM(&jvm);
|
||
|
|
|
||
|
|
// Run specific test
|
||
|
|
char* argv[] = {
|
||
|
|
const_cast<char*>("VavCoreTextureBindingTest"),
|
||
|
|
const_cast<char*>(test_name_str)
|
||
|
|
};
|
||
|
|
int result = main(2, argv);
|
||
|
|
|
||
|
|
env->ReleaseStringUTFChars(test_name, test_name_str);
|
||
|
|
|
||
|
|
__android_log_print(ANDROID_LOG_INFO, "VavCoreTextureTest", "JNI specific test execution completed with result: %d", result);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // extern "C"
|