2021-08-11 11:06:46 +03:00
/ /
2018-11-05 22:20:03 +03:00
// Unit tests for SCNAction
/ /
using System ;
using Foundation ;
using SceneKit ;
using ObjCRuntime ;
using NUnit.Framework ;
namespace MonoTouchFixtures.SceneKit {
[TestFixture]
[Preserve (AllMembers = true)]
public class ActionTest {
float timeFunctionValue ;
2018-11-08 20:41:19 +03:00
[SetUp]
public void SetUp ( )
{
TestRuntime . AssertXcodeVersion ( 6 , 0 ) ;
TestRuntime . AssertSystemVersion ( PlatformName . MacOSX , 10 , 10 , throwIfOtherPlatform : false ) ;
}
2018-11-05 22:20:03 +03:00
#if ! XAMCORE_4_0
[Test]
public void TimingFunction_5058 ( )
{
2018-11-28 17:09:03 +03:00
// API was introduced in iOS 8, but it's broken (it copies the block pointer instead of copying the block itself, which means that a block stored on the stack will not behave as expected when trying to invoke it later)
TestRuntime . AssertXcodeVersion ( 7 , 0 ) ;
2018-11-05 22:20:03 +03:00
var a = new SCNAction ( ) ;
Assert . Null ( a . TimingFunction2 , "TimingFunction2" ) ;
Assert . Null ( a . TimingFunction , "TimingFunction" ) ;
a . TimingFunction2 = ( float f ) = > {
timeFunctionValue = f ;
return timeFunctionValue ;
} ;
Assert . That ( a . TimingFunction2 ( Single . NaN ) , Is . NaN , "value returned" ) ;
a . TimingFunction ( Single . NaN ) ;
Assert . That ( timeFunctionValue , Is . NaN , "TimingFunction assigned from TimingFunction2" ) ;
}
#endif
[Test]
public void TimingFunction_5072 ( )
{
2018-11-28 17:09:03 +03:00
// API was introduced in iOS 8, but it's broken (it copies the block pointer instead of copying the block itself, which means that a block stored on the stack will not behave as expected when trying to invoke it later)
TestRuntime . AssertXcodeVersion ( 7 , 0 ) ;
2018-11-05 22:20:03 +03:00
// https://github.com/xamarin/xamarin-macios/issues/5072
var a = new SCNAction ( ) ;
#if ! XAMCORE_4_0
a . TimingFunction2 = ( float f ) = > {
timeFunctionValue = f ;
return timeFunctionValue ;
} ;
// Assert.Null (a.TimingFunction2, "TimingFunction2-end");
#else
a . TimingFunction = ( float f ) = > {
timeFunctionValue = f ;
return timeFunctionValue ;
} ;
#endif
// Assert.Null (a.TimingFunction, "TimingFunction-end");
}
}
2021-08-11 11:06:46 +03:00
}