SwtMisc { public static boolean flagIsSet(int flag, int style) { return (style & flag) == flag; }  static boolean flagIsSet(int flag, int style); static boolean flagIsSet(int flag, Widget widget); static int setFlag(int flag, boolean isSet, int style); static Listener asListener(Runnable runnable); static Display assertUI(); static void assertNotUI(); static Color getSystemColor(int code); static Cursor getSystemCursor(int cursor); static Image getSystemIcon(int icon); @Deprecated static void requestLayout(Control control); static void asyncLayout(Composite cmp); static void asyncLayoutOnResize(Composite cmp); static void clean(Composite cmp); static void assertClean(Composite cmp); static Event copyEvent(Event event); static void withGcRun(Consumer<GC> consumer); static T withGcCompute(Function<GC, T> function); static void loopUntil(Predicate<Display> until); static void loopUntilDisposed(Widget widget); static T loopUntilGet(CompletionStage<T> future); static void blockForSuccess(String title, String msg, @Nullable Shell parent); static void blockForSuccess(String title, String msg); static void blockForError(String title, String msg, @Nullable Shell parent); static void blockForError(String title, String msg); static boolean blockForQuestion(String title, String message, @Nullable Shell parent); static boolean blockForQuestion(String title, String message); static boolean blockForOkCancel(String title, String message, @Nullable Shell parent); static boolean blockForOkCancel(String title, String message); static int blockForMessageBox(String title, String message, @Nullable Shell parent, int style); static int blockForMessageBox(String title, String message, int style); static int systemFontHeight(); static int systemFontWidth(); static int systemFontSnug(); static int defaultButtonWidth(); static int defaultDialogWidth(); static Point scaleByFontHeight(int cols, int rows); static int scaleByFontHeight(int rows); static Point scaleByFont(int cols, int rows); static Point scaleByFont(String str); static Rectangle globalBounds(Control control); static Rectangle globalBounds(ControlWrapper control); static Rectangle toDisplay(Control control, Rectangle rect); static Optional<Monitor> monitorFor(Point p); static void setEnabledDeep(Composite root, boolean enabled); static void forEachDeep(Composite root, Consumer<Control> ctlSetter); static void setForegroundDeep(Composite root, Color foreground); static void setBackgroundDeep(Composite root, Color background); static Shell rootShell(Control ctl); static TreeDef.Parented<Composite> treeDefComposite(); static TreeDef.Parented<Control> treeDefControl(); static TreeDef.Parented<Shell> treeDefShell();  }
@Test public void flagIsSet() { Assert.assertTrue(SwtMisc.flagIsSet(SWT.NONE, SWT.NONE)); Assert.assertTrue(SwtMisc.flagIsSet(SWT.BOLD, SWT.BOLD)); Assert.assertFalse(SwtMisc.flagIsSet(SWT.ITALIC, SWT.BOLD)); Assert.assertFalse(SwtMisc.flagIsSet(SWT.BOLD, SWT.ITALIC)); Assert.assertTrue(SwtMisc.flagIsSet(SWT.ITALIC, SWT.ITALIC)); Assert.assertTrue(SwtMisc.flagIsSet(SWT.NONE, SWT.BOLD | SWT.ITALIC)); Assert.assertTrue(SwtMisc.flagIsSet(SWT.BOLD, SWT.BOLD | SWT.ITALIC)); Assert.assertTrue(SwtMisc.flagIsSet(SWT.ITALIC, SWT.BOLD | SWT.ITALIC)); Assert.assertFalse(SwtMisc.flagIsSet(37, SWT.BOLD | SWT.ITALIC)); }