public void Setup()
        {
#if MONOMAC
            // ModelIO seems to be broken in Xcode 12.2 Beta 3 so disabling for now.
            if (TestRuntime.CheckExactXcodeVersion(12, 2, beta: 3))
            {
                Assert.Inconclusive("ModelIO is not working in Xcode 12.2 Beta 3");
            }
#endif
            TestRuntime.AssertXcodeVersion(9, 0);
        }
Exemplo n.º 2
0
        public void DefaultCtor()
        {
#if MONOMAC
            // For some reason the init method is not allowed on Xcode 12.2 Beta 3 anymore
            // but was allowed before that said this class got deprecated in 10.10 so it may now be
            // a permanent change.
            if (TestRuntime.CheckExactXcodeVersion(12, 2, beta: 3))
            {
                Assert.Inconclusive("'LeaderboardViewControllerTest' the native 'init' method returned nil.");
            }
#endif
            TestRuntime.AssertSystemVersion(PlatformName.MacOSX, 10, 8, throwIfOtherPlatform: false);
            using (var vc = new GKLeaderboardViewController()) {
                Assert.Null(vc.Category, "Category");
                Assert.Null(vc.Delegate, "Delegate");
                // default Scope vary by iOS version and can't be changed on iOS7 - not worth testing
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Override this method if you want the test to skip some specific types.
        /// By default types decorated with [Model] will be skipped.
        /// </summary>
        /// <param name="type">The Type to be tested</param>
        protected virtual bool Skip(Type type)
        {
            if (type.ContainsGenericParameters)
            {
                return(true);
            }

            switch (type.Name)
            {
            case "JSExport":
                // This is interesting: Apple defines a private JSExport class - if you try to define your own in an Objective-C project you get this warning at startup:
                //     objc[334]: Class JSExport is implemented in both /Applications/Xcode91.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore (0x112c1e430) and /Users/rolf/Library/Developer/CoreSimulator/Devices/AC5323CF-225F-44D9-AA18-A37B7C28CA68/data/Containers/Bundle/Application/DEF9EAFC-CB5C-454F-97F5-669BBD00A609/jsexporttest.app/jsexporttest (0x105b49df0). One of the two will be used. Which one is undefined.
                // Due to how we treat models, we'll always look the Objective-C type up at runtime (even with the static registrar),
                // see that there's an existing JSExport type, and use that one instead of creating a new type.
                // This is problematic, because Apple's JSExport is completely unusable, and will crash if you try to do anything.
                return(true);

            // on iOS 8.2 (beta 1) we get:  NSInvalidArgumentException Caller did not provide an activityType, and this process does not have a NSUserActivityTypes in its Info.plist.
            // even if we specify an NSUserActivityTypes in the Info.plist - might be a bug or there's a new (undocumented) requirement
            case "NSUserActivity":
                return(true);

            case "NEPacketTunnelProvider":
                return(true);

            // On iOS 14 (beta 4) we get: [NISimulator] To simulate Nearby Interaction distance and direction, launch two or more simulators and
            // move the simulator windows around the screen.
            // The same error occurs when trying to default init NISession in Xcode.
            // It seems that it is only possible to create a NISession when there are two devices or sims running, which makes sense given the description of
            // NISession from Apple API docs: "An object that identifies a unique connection between two peer devices"
            case "NISession":
                return(true);

            case "NSUnitDispersion":                  // -init should never be called on NSUnit!
            case "NSUnitVolume":                      // -init should never be called on NSUnit!
            case "NSUnitDuration":                    // -init should never be called on NSUnit!
            case "NSUnitElectricCharge":              // -init should never be called on NSUnit!
            case "NSUnitElectricCurrent":             // -init should never be called on NSUnit!
            case "NSUnitElectricPotentialDifference": // -init should never be called on NSUnit!
            case "NSUnitElectricResistance":          // -init should never be called on NSUnit!
            case "NSUnit":                            // -init should never be called on NSUnit!
            case "NSUnitEnergy":                      // -init should never be called on NSUnit!
            case "NSUnitAcceleration":                // -init should never be called on NSUnit!
            case "NSUnitFrequency":                   // -init should never be called on NSUnit!
            case "NSUnitAngle":                       // -init should never be called on NSUnit!
            case "NSUnitFuelEfficiency":              // -init should never be called on NSUnit!
            case "NSUnitArea":                        // -init should never be called on NSUnit!
            case "NSUnitIlluminance":                 // -init should never be called on NSUnit!
            case "NSUnitConcentrationMass":           // -init should never be called on NSUnit!
            case "NSUnitLength":                      // -init should never be called on NSUnit!
            case "NSUnitMass":                        // -init should never be called on NSUnit!
            case "NSUnitPower":                       // -init should never be called on NSUnit!
            case "NSUnitPressure":                    // -init should never be called on NSUnit!
            case "NSUnitSpeed":                       // -init should never be called on NSUnit!
                return(true);

            case "NSMenuView":
                return(TestRuntime.IsVM);    // skip on vms due to hadware problems

            case "MPSCnnNeuron":             // Cannot directly initialize MPSCNNNeuron. Use one of the sub-classes of MPSCNNNeuron
            case "MPSCnnNeuronPReLU":
            case "MPSCnnNeuronHardSigmoid":
            case "MPSCnnNeuronSoftPlus":
                return(true);

            case "MPSCnnBinaryConvolution":         // [MPSCNNBinaryConvolution initWithDevice:] is not allowed. Please use initializers that are not marked NS_UNAVAILABLE.
            case "MPSCnnDilatedPoolingMax":         // [MPSCNNDilatedPoolingMax initWithDevice:] is not allowed. Please use initializers that are not marked NS_UNAVAILABLE.
            case "MPSCnnPoolingL2Norm":             // [MPSCNNPoolingL2Norm initWithDevice:] is not allowed. Please use initializers that are not marked NS_UNAVAILABLE.
                return(true);

            case "MPSCnnBinaryFullyConnected":             // Please initialize the MPSCNNBinaryFullyConnected class with initWithDevice:convolutionDescriptor:kernelWeights:biasTerms
                return(true);

            case "MPSCnnUpsampling":             // Cannot directly initialize MPSCNNUpsampling. Use one of the sub-classes of MPSCNNUpsampling
            case "MPSCnnUpsamplingBilinear":
            case "MPSCnnUpsamplingNearest":
                return(true);

            case "MPSImageArithmetic":             // Cannot directly initialize MPSImageArithmetic. Use one of the sub-classes of MPSImageArithmetic.
                return(true);

            case "CKDiscoverUserInfosOperation":             // deprecated, throws exception
            case "CKSubscription":
            case "MPSCnnConvolutionState":
                return(true);

            case "AVSpeechSynthesisVoice":                    // Calling description crashes the test
#if __WATCHOS__
                return(TestRuntime.CheckXcodeVersion(12, 2)); // CheckExactXcodeVersion is not implemented in watchOS yet but will be covered by iOS parrot below
#else
                return(TestRuntime.CheckExactXcodeVersion(12, 2, beta: 3));
#endif
            }

            switch (type.Namespace)
            {
#if __IOS__
            case "WatchKit":
                return(true);                // WatchKit has been removed from iOS.
#elif MONOMAC
            case "QTKit":
                return(true);                // QTKit has been removed from macos.
#endif
            }

            // skip types that we renamed / rewrite since they won't behave correctly (by design)
            if (SkipDueToRejectedTypes(type))
            {
                return(true);
            }

            return(SkipDueToAttribute(type));
        }