mirror of
https://github.com/brl/mutter.git
synced 2024-12-28 22:02:14 +00:00
eb7fafe700
This adds a white-box unit test that verifies that GL_BLEND is disabled when drawing an opaque rectangle, enabled when drawing a transparent rectangle and then disabled again when drawing a transparent rectangle but with a blend string that effectively disables blending. This shares the test utilities and launcher infrastructure we are using for conformance tests so we get consistent reporting and so unit tests will be run against a range of different drivers. This adds a --enable-unit-tests configure option which is enabled by default but if disabled will make all UNIT_TESTS() into static inline functions that we should expect the compiler to discard since they won't be referenced by anything. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 9047cce06bbf9051ec77e622be2fdbb96ed767a8)
32 lines
687 B
C
32 lines
687 B
C
#ifndef _TEST_UNIT_H_
|
|
#define _TEST_UNIT_H_
|
|
|
|
#include <test-fixtures/test-utils.h>
|
|
|
|
#ifdef ENABLE_UNIT_TESTS
|
|
|
|
typedef struct _CoglUnitTest
|
|
{
|
|
const char *name;
|
|
TestFlags requirement_flags;
|
|
TestFlags known_failure_flags;
|
|
void (*run) (void);
|
|
} CoglUnitTest;
|
|
|
|
#define UNIT_TEST(NAME, REQUIREMENT_FLAGS, KNOWN_FAILURE_FLAGS) \
|
|
static void NAME (void); \
|
|
\
|
|
const CoglUnitTest unit_test_##NAME = \
|
|
{ #NAME, REQUIREMENT_FLAGS, KNOWN_FAILURE_FLAGS, NAME }; \
|
|
\
|
|
static void NAME (void)
|
|
|
|
#else /* ENABLE_UNIT_TESTS */
|
|
|
|
#define UNIT_TEST(NAME, REQUIREMENT_FLAGS, KNOWN_FAILURE_FLAGS) \
|
|
static inline void NAME (void)
|
|
|
|
#endif /* ENABLE_UNIT_TESTS */
|
|
|
|
#endif /* _TEST_UNIT_H_ */
|