I still believe this code is wrong. NSWindowCollectionBehavior is a bit field (mask), so if the value contains more than one bit value, e.g. both NSWindowCollectionBehaviorFullScreenPrimary and NSWindowCollectionBehaviorCanJoinAllSpaces, then your tests return the wrong result.