From: Behdad Esfahbod Date: Sat, 14 Apr 2012 23:19:26 +0000 (-0400) Subject: Add HB_DIRECTION_IS_VALID X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe28b997fbbeb2cfeab62ac453993ccffe3e6719;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Add HB_DIRECTION_IS_VALID --- diff --git a/src/hb-common.h b/src/hb-common.h index 26c056b..eefe984 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -118,6 +118,7 @@ hb_direction_to_string (hb_direction_t direction); #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6) #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4) #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5) +#define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4) #define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1)) diff --git a/test/api/test-common.c b/test/api/test-common.c index 7441d09..74b50be 100644 --- a/test/api/test-common.c +++ b/test/api/test-common.c @@ -78,6 +78,13 @@ test_types_direction (void) g_assert (HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_BTT)); g_assert (!HB_DIRECTION_IS_BACKWARD (HB_DIRECTION_INVALID)); + g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_LTR)); + g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_TTB)); + g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_RTL)); + g_assert (HB_DIRECTION_IS_VALID (HB_DIRECTION_BTT)); + g_assert (!HB_DIRECTION_IS_VALID (HB_DIRECTION_INVALID)); + g_assert (!HB_DIRECTION_IS_VALID ((hb_direction_t) 0x12345678)); + g_assert_cmpint (HB_DIRECTION_REVERSE (HB_DIRECTION_LTR), ==, HB_DIRECTION_RTL); g_assert_cmpint (HB_DIRECTION_REVERSE (HB_DIRECTION_RTL), ==, HB_DIRECTION_LTR); g_assert_cmpint (HB_DIRECTION_REVERSE (HB_DIRECTION_TTB), ==, HB_DIRECTION_BTT);