From 77fdf997072ced6bd4fd941b36c980b7836eff1b Mon Sep 17 00:00:00 2001 From: Johnathan Becker Date: Thu, 10 Oct 2024 12:04:07 -0600 Subject: [PATCH 1/4] add test --- Tests/gui/GSCodingFlags/GSCellFlags.m | 62 +++++++++++++++++++++++++++ Tests/gui/GSCodingFlags/TestInfo | 0 2 files changed, 62 insertions(+) create mode 100644 Tests/gui/GSCodingFlags/GSCellFlags.m create mode 100644 Tests/gui/GSCodingFlags/TestInfo diff --git a/Tests/gui/GSCodingFlags/GSCellFlags.m b/Tests/gui/GSCodingFlags/GSCellFlags.m new file mode 100644 index 0000000000..43002c91e9 --- /dev/null +++ b/Tests/gui/GSCodingFlags/GSCellFlags.m @@ -0,0 +1,62 @@ +#include "Testing.h" + +#include +#include + +#include +#include "GSCodingFlags.h" + +int main() +{ + CREATE_AUTORELEASE_POOL(arp); + GSCellFlagsUnion mask = { { 0 } }; + + START_SET("GSCodingFlags GNUstep CellFlags Union") + + NS_DURING + { + [NSApplication sharedApplication]; + } + NS_HANDLER + { + if ([[localException name] isEqualToString: NSInternalInconsistencyException ]) + SKIP("It looks like GNUstep backend is not yet installed") + } + NS_ENDHANDLER + // first make sure flags translate to values + mask.flags.state = 1; + mask.flags.selectable = 1; + mask.flags.scrollable = 1; + mask.flags.editable = 1; + mask.flags.continuous = 1; + mask.flags.useUserKeyEquivalent = 1; + mask.flags.truncateLastLine = 1; + +#if GS_WORDS_BIGENDIAN == 1 + pass(mask.value == 0b00010010000000000001110000001001, "mask.flags translates to mask.value"); +#else + pass(mask.value == 0b10010000001110000000000001001000, "mask.flags translates to mask.value"); +#endif + // reset mask + mask.value = 0; + mask.flags = (GSCellFlags){0}; + // now make sure values translate to flags +#if GS_WORDS_BIGENDIAN == 1 + mask.value = 0b00000001001000000000110100000001; +#else + mask.value = 0b00000001001000000000110100000001; +#endif + + pass(mask.flags.state = 1, "state is correctly set"); + pass(mask.flags.selectable = 1, "selectable is correctly set"); + pass(mask.flags.scrollable = 1, "scrollable is correctly set"); + pass(mask.flags.editable = 1, "editable is correctly set"); + pass(mask.flags.continuous = 1, "continuous is correctly set"); + pass(mask.flags.useUserKeyEquivalent = 1, "useUserKeyEquivalent is correctly set"); + pass(mask.flags.truncateLastLine = 1, "truncateLastLine is correctly set"); + + END_SET("GSCodingFlags GNUstep CellFlags Union") + + DESTROY(arp); + return 0; +} \ No newline at end of file diff --git a/Tests/gui/GSCodingFlags/TestInfo b/Tests/gui/GSCodingFlags/TestInfo new file mode 100644 index 0000000000..e69de29bb2 From f9786897b38574865b77e32cf7c1f0e0ca17b7a8 Mon Sep 17 00:00:00 2001 From: Johnathan Becker Date: Fri, 11 Oct 2024 10:59:52 -0500 Subject: [PATCH 2/4] remove backend call --- Tests/gui/GSCodingFlags/GSCellFlags.m | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Tests/gui/GSCodingFlags/GSCellFlags.m b/Tests/gui/GSCodingFlags/GSCellFlags.m index 43002c91e9..2b10035689 100644 --- a/Tests/gui/GSCodingFlags/GSCellFlags.m +++ b/Tests/gui/GSCodingFlags/GSCellFlags.m @@ -3,7 +3,6 @@ #include #include -#include #include "GSCodingFlags.h" int main() @@ -13,16 +12,6 @@ int main() START_SET("GSCodingFlags GNUstep CellFlags Union") - NS_DURING - { - [NSApplication sharedApplication]; - } - NS_HANDLER - { - if ([[localException name] isEqualToString: NSInternalInconsistencyException ]) - SKIP("It looks like GNUstep backend is not yet installed") - } - NS_ENDHANDLER // first make sure flags translate to values mask.flags.state = 1; mask.flags.selectable = 1; From fe6fe78afee6309b1b78c8cebe0afd057ec7b075 Mon Sep 17 00:00:00 2001 From: Johnathan Becker Date: Mon, 14 Oct 2024 10:10:06 -0600 Subject: [PATCH 3/4] fix this --- Tests/gui/GSCodingFlags/GSCellFlags.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/gui/GSCodingFlags/GSCellFlags.m b/Tests/gui/GSCodingFlags/GSCellFlags.m index 43002c91e9..3bc91b0fe9 100644 --- a/Tests/gui/GSCodingFlags/GSCellFlags.m +++ b/Tests/gui/GSCodingFlags/GSCellFlags.m @@ -42,9 +42,9 @@ int main() mask.flags = (GSCellFlags){0}; // now make sure values translate to flags #if GS_WORDS_BIGENDIAN == 1 - mask.value = 0b00000001001000000000110100000001; + mask.value = 0b00010010000000000001110000001001; #else - mask.value = 0b00000001001000000000110100000001; + mask.value = 0b10010000001110000000000001001000; #endif pass(mask.flags.state = 1, "state is correctly set"); From 7797316d827a27279c41a425f581ce621512781a Mon Sep 17 00:00:00 2001 From: Johnathan Becker Date: Mon, 14 Oct 2024 14:28:38 -0600 Subject: [PATCH 4/4] fix = --- Tests/gui/GSCodingFlags/GSCellFlags.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/gui/GSCodingFlags/GSCellFlags.m b/Tests/gui/GSCodingFlags/GSCellFlags.m index f8373330d8..9279b55999 100644 --- a/Tests/gui/GSCodingFlags/GSCellFlags.m +++ b/Tests/gui/GSCodingFlags/GSCellFlags.m @@ -36,13 +36,13 @@ int main() mask.value = 0b10010000001110000000000001001000; #endif - pass(mask.flags.state = 1, "state is correctly set"); - pass(mask.flags.selectable = 1, "selectable is correctly set"); - pass(mask.flags.scrollable = 1, "scrollable is correctly set"); - pass(mask.flags.editable = 1, "editable is correctly set"); - pass(mask.flags.continuous = 1, "continuous is correctly set"); - pass(mask.flags.useUserKeyEquivalent = 1, "useUserKeyEquivalent is correctly set"); - pass(mask.flags.truncateLastLine = 1, "truncateLastLine is correctly set"); + pass(mask.flags.state == 1, "state is correctly set"); + pass(mask.flags.selectable == 1, "selectable is correctly set"); + pass(mask.flags.scrollable == 1, "scrollable is correctly set"); + pass(mask.flags.editable == 1, "editable is correctly set"); + pass(mask.flags.continuous == 1, "continuous is correctly set"); + pass(mask.flags.useUserKeyEquivalent == 1, "useUserKeyEquivalent is correctly set"); + pass(mask.flags.truncateLastLine == 1, "truncateLastLine is correctly set"); END_SET("GSCodingFlags GNUstep CellFlags Union")