@@ -737,6 +737,8 @@ - (void) testWindowResize {
737
737
[self waitForVimClose ];
738
738
}
739
739
740
+ #pragma mark Full screen tests
741
+
740
742
- (void )waitForNativeFullscreenEnter {
741
743
XCTestExpectation *expectation = [self expectationWithDescription: @" NativeFullscreenEnter" ];
742
744
@@ -862,4 +864,114 @@ - (void) testFullScreenNative {
862
864
[self fullScreenTestWithNative: YES ];
863
865
}
864
866
867
+ - (void ) testFullScreenNonNativeOptions {
868
+ MMAppController *app = MMAppController.sharedInstance ;
869
+
870
+ // Cache test defaults
871
+ NSUserDefaults *ud = NSUserDefaults .standardUserDefaults ;
872
+ NSDictionary <NSString *, id > *defaults = [ud volatileDomainForName: NSArgumentDomain ];
873
+ NSMutableDictionary <NSString *, id > *newDefaults = [defaults mutableCopy ];
874
+
875
+ // Change native full screen setting
876
+ newDefaults[MMNativeFullScreenKey] = @NO ;
877
+ [ud setVolatileDomain: newDefaults forName: NSArgumentDomain ];
878
+
879
+ [app openNewWindow: NewWindowClean activate: YES ];
880
+ [self waitForVimOpenAndMessages ];
881
+
882
+ MMWindowController *winController = app.keyVimController .windowController ;
883
+ MMTextView *textView = [[winController vimView ] textView ];
884
+
885
+ // Test maxvert/maxhorz
886
+ [self sendStringToVim: @" :set lines=10\n " withMods: 0 ];
887
+ [self sendStringToVim: @" :set columns=30\n " withMods: 0 ];
888
+ [self sendStringToVim: @" :set fuoptions=\n " withMods: 0 ];
889
+ [self waitForVimProcess ];
890
+
891
+ [self sendStringToVim: @" :set fu\n " withMods: 0 ];
892
+ [self waitForEventHandlingAndVimProcess ];
893
+ [self waitForEventHandlingAndVimProcess ];
894
+ XCTAssertEqual (textView.maxRows , 10 );
895
+ XCTAssertEqual (textView.maxColumns , 30 );
896
+ [self sendStringToVim: @" :set nofu\n " withMods: 0 ];
897
+ [self sendStringToVim: @" :set fuoptions=maxvert\n " withMods: 0 ];
898
+ [self sendStringToVim: @" :set fu\n " withMods: 0 ];
899
+ [self waitForEventHandlingAndVimProcess ];
900
+ [self waitForEventHandlingAndVimProcess ];
901
+ XCTAssertGreaterThan (textView.maxRows , 10 );
902
+ XCTAssertEqual (textView.maxColumns , 30 );
903
+ [self sendStringToVim: @" :set nofu\n " withMods: 0 ];
904
+ [self sendStringToVim: @" :set fuoptions=maxhorz\n " withMods: 0 ];
905
+ [self sendStringToVim: @" :set fu\n " withMods: 0 ];
906
+ [self waitForEventHandlingAndVimProcess ];
907
+ [self waitForEventHandlingAndVimProcess ];
908
+ XCTAssertEqual (textView.maxRows , 10 );
909
+ XCTAssertGreaterThan (textView.maxColumns , 30 );
910
+ [self sendStringToVim: @" :set nofu\n " withMods: 0 ];
911
+ [self sendStringToVim: @" :set fuoptions=maxhorz,maxvert\n " withMods: 0 ];
912
+ [self sendStringToVim: @" :set fu\n " withMods: 0 ];
913
+ [self waitForEventHandlingAndVimProcess ];
914
+ [self waitForEventHandlingAndVimProcess ];
915
+ XCTAssertGreaterThan (textView.maxRows , 10 );
916
+ XCTAssertGreaterThan (textView.maxColumns , 30 );
917
+
918
+ // Test background color
919
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithArgbInt: 0xff000000 ]); // default is black
920
+
921
+ // Make sure changing colorscheme doesn't override the background color unlike in non-full screen mode
922
+ [self sendStringToVim: @" :color desert\n " withMods: 0 ];
923
+ [self waitForEventHandlingAndVimProcess ];
924
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithArgbInt: 0xff000000 ]);
925
+
926
+ // Changing fuoptions should update the background color immediately
927
+ [self sendStringToVim: @" :set fuoptions=background:Normal\n " withMods: 0 ];
928
+ [self waitForEventHandlingAndVimProcess ];
929
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithArgbInt: 0xff333333 ]);
930
+
931
+ // And switching colorscheme should also update the color as well
932
+ [self sendStringToVim: @" :color blue\n " withMods: 0 ];
933
+ [self waitForEventHandlingAndVimProcess ];
934
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithArgbInt: 0xff000087 ]);
935
+
936
+ // Test parsing manual colors in both 8-digit mode (alpha is ignored) and 6-digit mode
937
+ [self sendStringToVim: @" :set fuoptions=background:#11234567\n " withMods: 0 ];
938
+ [self waitForEventHandlingAndVimProcess ];
939
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithArgbInt: 0xff234567 ]);
940
+ [self sendStringToVim: @" :set fuoptions=background:#abcdef\n " withMods: 0 ];
941
+ [self waitForEventHandlingAndVimProcess ];
942
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithArgbInt: 0xffabcdef ]);
943
+
944
+ // Test setting transparency while in full screen. We always set the alpha of the background color to 0.001 when transparency is set.
945
+ [self sendStringToVim: @" :set fuoptions=background:#ffff00\n :set transparency=50\n " withMods: 0 ];
946
+ [self waitForEventHandlingAndVimProcess ];
947
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithRed: 1 green: 1 blue: 0 alpha: 0.001 ]);
948
+
949
+ [self sendStringToVim: @" :set fuoptions=background:#00ff00\n " withMods: 0 ];
950
+ [self waitForEventHandlingAndVimProcess ];
951
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithRed: 0 green: 1 blue: 0 alpha: 0.001 ]);
952
+
953
+ [self sendStringToVim: @" :set transparency=0\n " withMods: 0 ];
954
+ [self waitForEventHandlingAndVimProcess ];
955
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithRed: 0 green: 1 blue: 0 alpha: 1 ]);
956
+
957
+ // Test setting transparency outside of full screen and make sure it still works
958
+ [self sendStringToVim: @" :set nofu\n " withMods: 0 ];
959
+ [self waitForEventHandlingAndVimProcess ];
960
+ [self waitForEventHandlingAndVimProcess ];
961
+ [self sendStringToVim: @" :set transparency=50 fuoptions=background:#0000ff\n " withMods: 0 ];
962
+ [self sendStringToVim: @" :set fu\n " withMods: 0 ];
963
+ [self waitForEventHandlingAndVimProcess ];
964
+ [self waitForEventHandlingAndVimProcess ];
965
+ XCTAssertEqualObjects (winController.window .backgroundColor , [NSColor colorWithRed: 0 green: 0 blue: 1 alpha: 0.001 ]);
966
+
967
+ // Clean up
968
+ [[app keyVimController ] sendMessage: VimShouldCloseMsgID data: nil ];
969
+ [self waitForVimClose ];
970
+
971
+ XCTAssertEqual (0 , [app vimControllers ].count );
972
+
973
+ // Restore settings to test defaults
974
+ [ud setVolatileDomain: defaults forName: NSArgumentDomain ];
975
+ }
976
+
865
977
@end
0 commit comments