Skip to content

Commit

Permalink
Merge pull request #1 from glouel/bugtest
Browse files Browse the repository at this point in the history
Bugtest
  • Loading branch information
glouel authored Jul 17, 2020
2 parents d078c51 + 4bca547 commit e47dcc7
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 17 deletions.
38 changes: 38 additions & 0 deletions SaverTest/Assets.xcassets/Accent Color.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.866",
"green" : "0.043",
"red" : "0.579"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.952",
"green" : "0.000",
"red" : "0.762"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions SaverTest/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
27 changes: 21 additions & 6 deletions ScreenSaverMinimal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
034D858C1B64DF4D00D2EF6B /* ConfigureSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 034D858B1B64DF4D00D2EF6B /* ConfigureSheet.xib */; };
034D85901B64F0AD00D2EF6B /* ConfigureSheetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 034D858F1B64F0AD00D2EF6B /* ConfigureSheetController.swift */; };
03A485271B644187008A2D6A /* ScreenSaverMinimalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A485261B644187008A2D6A /* ScreenSaverMinimalView.swift */; };
03D29C0F24A262B400D61A02 /* ConfigureSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 03D29C1224A262B400D61A02 /* ConfigureSheet.xib */; };
03D29C1024A262B400D61A02 /* ConfigureSheet.xib in Sources */ = {isa = PBXBuildFile; fileRef = 03D29C1224A262B400D61A02 /* ConfigureSheet.xib */; };
03F3BD4324A2462600F7CD7A /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F3BD4224A2462500F7CD7A /* Preferences.swift */; };
03F3BD4424A2462600F7CD7A /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03F3BD4224A2462500F7CD7A /* Preferences.swift */; };
03F9545E1B695E0A00E47ED7 /* thumbnail.png in Resources */ = {isa = PBXBuildFile; fileRef = 03F9545D1B695E0A00E47ED7 /* thumbnail.png */; };
Expand All @@ -18,15 +19,15 @@
ACD891891DC38B790019C16F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = ACD891871DC38B790019C16F /* MainMenu.xib */; };
ACD8918E1DC38C4B0019C16F /* ScreenSaverMinimalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A485261B644187008A2D6A /* ScreenSaverMinimalView.swift */; };
ACD8918F1DC38C4B0019C16F /* ConfigureSheetController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 034D858F1B64F0AD00D2EF6B /* ConfigureSheetController.swift */; };
ACD891901DC38C4B0019C16F /* ConfigureSheet.xib in Sources */ = {isa = PBXBuildFile; fileRef = 034D858B1B64DF4D00D2EF6B /* ConfigureSheet.xib */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
034D858B1B64DF4D00D2EF6B /* ConfigureSheet.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConfigureSheet.xib; sourceTree = "<group>"; };
034D858F1B64F0AD00D2EF6B /* ConfigureSheetController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigureSheetController.swift; sourceTree = "<group>"; };
03A485181B644145008A2D6A /* ScreenSaverMinimal.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ScreenSaverMinimal.saver; sourceTree = BUILT_PRODUCTS_DIR; };
03A4851C1B644145008A2D6A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
03A485261B644187008A2D6A /* ScreenSaverMinimalView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenSaverMinimalView.swift; sourceTree = "<group>"; };
03D29C1124A262B400D61A02 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ConfigureSheet.xib; sourceTree = "<group>"; };
03D29C1324A2632900D61A02 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/ConfigureSheet.xib; sourceTree = "<group>"; };
03F3BD4224A2462500F7CD7A /* Preferences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
03F9545D1B695E0A00E47ED7 /* thumbnail.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = thumbnail.png; sourceTree = "<group>"; };
ACD891811DC38B790019C16F /* SaverTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SaverTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -78,7 +79,7 @@
03F3BD4224A2462500F7CD7A /* Preferences.swift */,
03A485261B644187008A2D6A /* ScreenSaverMinimalView.swift */,
034D858F1B64F0AD00D2EF6B /* ConfigureSheetController.swift */,
034D858B1B64DF4D00D2EF6B /* ConfigureSheet.xib */,
03D29C1224A262B400D61A02 /* ConfigureSheet.xib */,
03A4851B1B644145008A2D6A /* Supporting Files */,
);
path = ScreenSaverMinimal;
Expand Down Expand Up @@ -179,6 +180,7 @@
knownRegions = (
en,
Base,
fr,
);
mainGroup = 03A4850E1B644145008A2D6A;
productRefGroup = 03A485191B644145008A2D6A /* Products */;
Expand All @@ -196,7 +198,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
034D858C1B64DF4D00D2EF6B /* ConfigureSheet.xib in Resources */,
03D29C0F24A262B400D61A02 /* ConfigureSheet.xib in Resources */,
03F9545E1B695E0A00E47ED7 /* thumbnail.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -230,14 +232,23 @@
ACD8918E1DC38C4B0019C16F /* ScreenSaverMinimalView.swift in Sources */,
ACD8918F1DC38C4B0019C16F /* ConfigureSheetController.swift in Sources */,
03F3BD4424A2462600F7CD7A /* Preferences.swift in Sources */,
ACD891901DC38C4B0019C16F /* ConfigureSheet.xib in Sources */,
03D29C1024A262B400D61A02 /* ConfigureSheet.xib in Sources */,
ACD891841DC38B790019C16F /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
03D29C1224A262B400D61A02 /* ConfigureSheet.xib */ = {
isa = PBXVariantGroup;
children = (
03D29C1124A262B400D61A02 /* en */,
03D29C1324A2632900D61A02 /* fr */,
);
name = ConfigureSheet.xib;
sourceTree = "<group>";
};
ACD891871DC38B790019C16F /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
Expand All @@ -253,6 +264,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "Accent Color";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -307,6 +320,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = "Accent Color";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down
26 changes: 24 additions & 2 deletions ScreenSaverMinimal/ScreenSaverMinimalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,24 @@ import ScreenSaver
class ScreenSaverMinimalView : ScreenSaverView {

lazy var sheetController: ConfigureSheetController = ConfigureSheetController()

var isPreviewBug: Bool = false

override init(frame: NSRect, isPreview: Bool) {
super.init(frame: frame, isPreview: isPreview)!
// Radar# FB7486243, legacyScreenSaver.appex always returns true, unlike what used
// to happen in previous macOS versions, see documentation here : https://developer.apple.com/documentation/screensaver/screensaverview/1512475-init$

var preview = true

// We can workaround that bug by looking at the size of the frame
// It's always 296.0 x 184.0 when running in preview mode
if frame.width > 400 && frame.height > 300 {
if isPreview {
isPreviewBug = true
}
preview = false
}

super.init(frame: frame, isPreview: preview)!
}

required init?(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -45,6 +59,14 @@ class ScreenSaverMinimalView : ScreenSaverView {
let bPath:NSBezierPath = NSBezierPath(rect: bounds)
Preferences.canvasColor.nsColor.set()
bPath.fill()

// This is the debug view
let debugTextView = NSTextView(frame: bounds.insetBy(dx: 20, dy: 20))
debugTextView.font = .labelFont(ofSize: 30)
debugTextView.string += "Radar# FB7486243 (isPreview bug) : \(isPreviewBug) \n"

self.addSubview(debugTextView)

}

override func animateOneFrame() {
Expand Down
119 changes: 119 additions & 0 deletions ScreenSaverMinimal/en.lproj/ConfigureSheet.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17132" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17132"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConfigureSheetController" customModule="SaverTest" customModuleProvider="target">
<connections>
<outlet property="canvasColorWell" destination="gt4-XW-IhQ" id="Qkh-Dd-Ph3"/>
<outlet property="window" destination="QvC-M9-y7g" id="t14-la-H7W"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window identifier="MinimalSaver" title="MinimalSaver" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="284" height="287"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="284" height="287"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="syD-V6-hat">
<rect key="frame" x="18" y="245" width="168" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="QcZ-s6-cYH"/>
</constraints>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Background:" id="Fx3-ie-87z">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<colorWell translatesAutoresizingMaskIntoConstraints="NO" id="gt4-XW-IhQ">
<rect key="frame" x="204" y="241" width="60" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="60" id="LXk-MH-a0c"/>
</constraints>
<color key="color" red="0.69123241402651436" green="0.8785381217277487" blue="0.30508141578484366" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="updateDefaults:" target="-2" id="UMf-Yg-0PY"/>
</connections>
</colorWell>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lsB-4d-KwF">
<rect key="frame" x="177" y="13" width="94" height="32"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="bI1-BY-gUk"/>
</constraints>
<buttonCell key="cell" type="push" title="Close" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ygf-Qk-bkW">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="closeConfigureSheet:" target="-2" id="D8m-7x-6Cs"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Pr7-fa-iXE">
<rect key="frame" x="18" y="148" width="248" height="73"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" selectable="YES" id="2hl-ZC-gRq">
<font key="font" metaFont="system"/>
<string key="title">If you set your locale to french, you should see "Fond d'écran" above instead of "Background", radar #FB7588762 (fixed in Big Sur)</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Mqs-33-AnC">
<rect key="frame" x="20" y="108" width="48" height="48"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="COu-pb-zJ0">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ybB-U7-rB7">
<rect key="frame" x="12" y="102" width="173" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="TintColor should be purple :" id="ti1-7f-j1S">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fdL-Aj-OPg">
<rect key="frame" x="184" y="93" width="87" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nIJ-Cl-C4N">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES" changeBackground="YES" changeGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pmn-fb-Ur2">
<rect key="frame" x="12" y="84" width="125" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Radar# FB8048049" id="pfg-dx-a5x">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstItem="gt4-XW-IhQ" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="16" id="Qil-uh-HUZ"/>
<constraint firstItem="gt4-XW-IhQ" firstAttribute="trailing" secondItem="lsB-4d-KwF" secondAttribute="trailing" id="RLz-HC-LPP"/>
<constraint firstItem="syD-V6-hat" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="YFv-z4-4Ux"/>
<constraint firstAttribute="trailing" secondItem="gt4-XW-IhQ" secondAttribute="trailing" constant="20" symbolic="YES" id="esc-Yh-8Ki"/>
<constraint firstItem="syD-V6-hat" firstAttribute="centerY" secondItem="gt4-XW-IhQ" secondAttribute="centerY" id="hBB-dk-LTi"/>
<constraint firstItem="syD-V6-hat" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" symbolic="YES" id="iBe-de-NqA"/>
<constraint firstAttribute="bottom" secondItem="lsB-4d-KwF" secondAttribute="bottom" constant="20" symbolic="YES" id="maA-iF-lC1"/>
<constraint firstItem="gt4-XW-IhQ" firstAttribute="leading" secondItem="syD-V6-hat" secondAttribute="trailing" constant="20" id="wUR-hv-Ik2"/>
</constraints>
</view>
<point key="canvasLocation" x="423" y="550.5"/>
</window>
</objects>
</document>
Loading

0 comments on commit e47dcc7

Please sign in to comment.