00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef NATIVETESTCASE_H
00010 #define NATIVETESTCASE_H
00011
00012 #ifdef JAVAQX_TEST
00013
00014 #include "JavaQxCore.h"
00015
00016
00017
00018
00019
00026 class JAVAQX_EXPORT NativeTestCase : public QObject
00027 {
00028 Q_OBJECT
00029 public:
00030 NativeTestCase(JNIEnv *env, jobject obj);
00031 virtual ~NativeTestCase();
00032 public:
00033 static void initialize(JNIEnv *env, jclass cls);
00034 static jlong testObject(JNIEnv *env, jobject obj);
00035 protected:
00036 void failCondition(const char *condition = 0, const char *fileName = 0,
00037 int lineNumber = -1);
00038 protected:
00039 inline JNIEnv *env() const;
00040 inline jweak obj() const;
00041 private:
00042 JNIEnv *m_env;
00043 jweak m_obj;
00044 private:
00045 static jfieldID sm_testObjectFID;
00046 static jmethodID sm_failConditionMID;
00047 };
00048
00049
00050
00051
00052
00058 inline JNIEnv *NativeTestCase::env() const
00059 {
00060 return m_env;
00061 }
00062
00068 inline jweak NativeTestCase::obj() const
00069 {
00070 return m_obj;
00071 }
00072
00073
00074
00075
00076
00077 #define nativeTestCase (reinterpret_cast<NativeTestCase *>(testObject))
00078
00079 #endif // JAVAQX_TEST
00080
00081 #endif // NATIVETESTCASE_H
00082
00083
00084
00085
00086
00087
00088
00089