summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wcmCommon.c10
-rw-r--r--src/wcmConfig.c3
-rw-r--r--src/wcmUSB.c3
-rw-r--r--src/xf86Wacom.c3
-rw-r--r--src/xf86Wacom.h35
-rw-r--r--test/Makefile.am3
6 files changed, 42 insertions, 15 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index df71842..3cb93ee 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -307,7 +307,7 @@ static void sendAButton(InputInfoPtr pInfo, int button, int mask,
* @param flags Flags defining axis attributes: AXIS_INVERT and AXIS_BITWISE
* @return Relative change in axis value
*/
-static int getScrollDelta(int current, int old, int wrap, int flags)
+TEST_NON_STATIC int getScrollDelta(int current, int old, int wrap, int flags)
{
int delta;
@@ -352,7 +352,7 @@ static int getScrollDelta(int current, int old, int wrap, int flags)
* @param action_dn Array index of action to send on scroll down
* @return Array index of action that should be performed, or -1 if none.
*/
-static int getWheelButton(int delta, int action_up, int action_dn)
+TEST_NON_STATIC int getWheelButton(int delta, int action_up, int action_dn)
{
if (delta > 0)
return action_up;
@@ -815,7 +815,7 @@ void wcmSendEvents(InputInfoPtr pInfo, const WacomDeviceState* ds)
* @retval SUPPRESS_NONE Process event normally.
* @retval SUPPRESS_NON_MOTION Suppress all data but motion data.
*/
-static enum WacomSuppressMode
+TEST_NON_STATIC enum WacomSuppressMode
wcmCheckSuppress(WacomCommonPtr common,
const WacomDeviceState* dsOrig,
WacomDeviceState* dsNew)
@@ -1036,7 +1036,7 @@ static WacomToolPtr findTool(const WacomCommonPtr common,
*
* @see normalizePressure
*/
-static int
+TEST_NON_STATIC int
rebasePressure(const WacomDevicePtr priv, const WacomDeviceState *ds)
{
int min_pressure;
@@ -1065,7 +1065,7 @@ rebasePressure(const WacomDevicePtr priv, const WacomDeviceState *ds)
* @rebaes
* @see rebasePressure
*/
-static int
+TEST_NON_STATIC int
normalizePressure(const WacomDevicePtr priv, const WacomDeviceState *ds)
{
WacomCommonPtr common = priv->common;
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 2d19944..bb2c975 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -134,7 +134,8 @@ static void wcmFree(InputInfoPtr pInfo)
pInfo->private = NULL;
}
-static int wcmSetType(InputInfoPtr pInfo, const char *type)
+TEST_NON_STATIC int
+wcmSetType(InputInfoPtr pInfo, const char *type)
{
WacomDevicePtr priv = pInfo->private;
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index cf27a10..d3c6857 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1205,7 +1205,8 @@ static void usbParseAbsEvent(WacomCommonPtr common,
*
* @return The new button mask
*/
-static int mod_buttons(int buttons, int btn, int state)
+TEST_NON_STATIC int
+mod_buttons(int buttons, int btn, int state)
{
int mask;
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 6ecf036..b0a60ff 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -107,7 +107,8 @@ void wcmVirtualTabletPadding(InputInfoPtr pInfo)
* Initialize logical size and resolution for individual tool.
****************************************************************************/
-static void wcmInitialToolSize(InputInfoPtr pInfo)
+TEST_NON_STATIC void
+wcmInitialToolSize(InputInfoPtr pInfo)
{
WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
WacomCommonPtr common = priv->common;
diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
index 587bf48..c0448f2 100644
--- a/src/xf86Wacom.h
+++ b/src/xf86Wacom.h
@@ -43,12 +43,6 @@
#define LogMessageVerbSigSafe xf86MsgVerb
#endif
-/*****************************************************************************
- * Unit test hack
- ****************************************************************************/
-#ifdef DISABLE_STATIC
-#define static
-#endif
/******************************************************************************
* Debugging support
@@ -191,6 +185,35 @@ enum WacomSuppressMode {
};
/****************************************************************************/
+
+#ifndef UNIT_TESTS
+
+# define TEST_NON_STATIC static
+
+#else
+
+# define TEST_NON_STATIC
+
+/* For test suite */
+/* xf86Wacom.c */
+extern void wcmInitialToolSize(InputInfoPtr pInfo);
+
+/* wcmConfig.c */
+extern int wcmSetType(InputInfoPtr pInfo, const char *type);
+
+/* wcmCommon.c */
+extern int getScrollDelta(int current, int old, int wrap, int flags);
+extern int getWheelButton(int delta, int action_up, int action_dn);
+extern int rebasePressure(const WacomDevicePtr priv, const WacomDeviceState *ds);
+extern int normalizePressure(const WacomDevicePtr priv, const WacomDeviceState *ds);
+extern enum WacomSuppressMode wcmCheckSuppress(WacomCommonPtr common,
+ const WacomDeviceState* dsOrig,
+ WacomDeviceState* dsNew);
+
+/* wcmUSB.c */
+extern int mod_buttons(int buttons, int btn, int state);
+#endif /* UNIT_TESTS */
+
#endif /* __XF86WACOM_H */
/* vim: set noexpandtab tabstop=8 shiftwidth=8: */
diff --git a/test/Makefile.am b/test/Makefile.am
index 0977526..d16dca8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,7 +4,7 @@ include ../src/common.mk
check_PROGRAMS = wacom-tests
check_LTLIBRARIES = libwacom-test.la
libwacom_test_la_SOURCES =$(DRIVER_SOURCES)
-libwacom_test_la_CFLAGS = -DDISABLE_STATIC -I$(top_srcdir)/src $(XORG_CFLAGS) $(CWARNFLAGS) -fvisibility=default
+libwacom_test_la_CFLAGS = -DUNIT_TESTS -I$(top_srcdir)/src $(XORG_CFLAGS) $(CWARNFLAGS) -fvisibility=default
TESTS=$(check_PROGRAMS)
@@ -14,6 +14,7 @@ TEST_LDADD= libwacom-test.la
COMMON_SOURCES=fake-symbols.c fake-symbols.h
wacom_tests_LDADD=$(TEST_LDADD) $(UDEV_LIBS)
+wacom_tests_CFLAGS= -DUNIT_TESTS $(AM_CFLAGS)
wacom_tests_SOURCES=wacom-tests.c $(COMMON_SOURCES)
endif