public void FillStep4(dataSchedulerAppointmentInfo appdata) { var items = new ScheduleNewTripPageMap(); var page = new ScheduleNewTripPage(); var data = new ScheduleNewTripPageData(); var roundTrip = new RoundTrip(); var roundTripItems = new RoundTripMap(); Driver.ScrollToElement(items.NextBtn); Driver.ScrollToElement(items.ApptDateTime); items.ApptDateTime.Clear(); Driver.WaitForLoad(data.DefaultWait); roundTrip.FillStep4(appdata); try { Driver.CustomClick(roundTripItems.Validate); } catch (Exception ex) { Driver.SaveScreenshot(Helper.SCREEN_SHOT_PATH); Console.WriteLine($"{DateTime.Now} - Validate the trip on AppointmentInfo page. " + $"Exception message {ex.Message}. \n Please, see the screenshot with error"); } Driver.WaitForLoad(data.ValidationTimeout); }
public override string GetPropertyValue() { Vector4 asset = Vector4.zero; if (m_defaultValue != null) { asset = HDUtilsEx.ConvertGUIDToVector4(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_defaultValue))); } string assetVec = RoundTrip.ToRoundTrip(asset.x) + ", " + RoundTrip.ToRoundTrip(asset.y) + ", " + RoundTrip.ToRoundTrip(asset.z) + ", " + RoundTrip.ToRoundTrip(asset.w); string lineOne = string.Empty; string lineTwo = string.Empty; if (m_defaultInspector) { lineOne = PropertyAttributes + "[HideInInspector]_DiffusionProfileAsset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )"; lineTwo = "\n[HideInInspector]_DiffusionProfileHash(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip(HDShadowUtilsEx.Asfloat(DefaultHash)); } else { #if UNITY_2020_2_OR_NEWER lineOne = "\n[DiffusionProfile]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip(HDShadowUtilsEx.Asfloat(DefaultHash)); lineTwo = PropertyAttributes + "[HideInInspector]" + m_propertyName + "_Asset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )"; #else lineOne = PropertyAttributes + "[ASEDiffusionProfile(" + m_propertyName + ")]" + m_propertyName + "_asset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )"; lineTwo = "\n[HideInInspector]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip(HDShadowUtilsEx.Asfloat(DefaultHash)); #endif } return(lineOne + lineTwo); }
public async Task NullString() { var target = new ClassWithString(); var result = await RoundTrip.Run(target); Assert.Null(result.Property); }
public void ByteArray() { var target = new ClassWithByteArray { Property = new byte[] { 2, 3 } }; var result = RoundTrip.Run(target); CollectionAssert.AreEqual(new byte[] { 2, 3 }, result.Property); }
public async Task Guid() { var target = new ClassWithGuid { Property = new("45b14050-065c-4be7-8bb8-f3b46b8d94e6") }; var result = await RoundTrip.Run(target); Assert.Equal("45b14050-065c-4be7-8bb8-f3b46b8d94e6", result.Property.ToString()); }
public async Task ByteArray() { var target = new ClassWithByteArray { Property = new byte[] { 2, 3 } }; var result = await RoundTrip.Run(target); Assert.Equal(new byte[] { 2, 3 }, result.Property); }
public void String() { var target = new ClassWithString { Property = "Foo" }; var result = RoundTrip.Run(target); Assert.AreEqual("Foo", result.Property); }
public async Task String() { var target = new ClassWithString { Property = "Foo" }; var result = await RoundTrip.Run(target); Assert.Equal("Foo", result.Property); }
public async Task EmptyString() { var target = new ClassWithString { Property = string.Empty }; var result = await RoundTrip.Run(target); Assert.Empty(result.Property); }
//public override void OnNodeLayout( DrawInfo drawInfo ) //{ // base.OnNodeLayout( drawInfo ); // m_propertyDrawPos = m_remainingBox; // m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE * 2; // m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; //} //public override void DrawGUIControls( DrawInfo drawInfo ) //{ // base.DrawGUIControls( drawInfo ); // if( drawInfo.CurrentEventType != EventType.MouseDown ) // return; // Rect hitBox = m_remainingBox; // bool insideBox = hitBox.Contains( drawInfo.MousePosition ); // if( insideBox ) // { // GUI.FocusControl( null ); // m_isEditingFields = true; // } // else if( m_isEditingFields && !insideBox ) // { // GUI.FocusControl( null ); // m_isEditingFields = false; // } //} //GUIStyle GetStyle( string styleName ) //{ // GUIStyle s = GUI.skin.FindStyle( styleName ) ?? EditorGUIUtility.GetBuiltinSkin( EditorSkin.Inspector ).FindStyle( styleName ); // if( s == null ) // { // Debug.LogError( "Missing built-in guistyle " + styleName ); // s = GUIStyle.none; // } // return s; //} //public override void Draw( DrawInfo drawInfo ) //{ // base.Draw( drawInfo ); // if( !m_isVisible ) // return; // var cache = EditorStyles.objectField.fontSize; // EditorStyles.objectField.fontSize = (int)(9 * drawInfo.InvertedZoom); // var style = GetStyle( "ObjectFieldButton" ); // var sw = style.stretchWidth; // style.stretchWidth = false; // //style.isHeightDependantOnWidth // style.fixedWidth = (int)( 16 * drawInfo.InvertedZoom ); // style.fixedHeight = (int)( 16 * drawInfo.InvertedZoom ); // //if( m_isEditingFields && m_currentParameterType != PropertyType.Global ) // //{ // float labelWidth = EditorGUIUtility.labelWidth; // EditorGUIUtility.labelWidth = 0; // if( m_materialMode && m_currentParameterType != PropertyType.Constant ) // { // EditorGUI.BeginChangeCheck(); // m_materialValue = EditorGUIObjectField( m_propertyDrawPos, m_materialValue, typeof( DiffusionProfileSettings ), true ) as DiffusionProfileSettings; // if( EditorGUI.EndChangeCheck() ) // { // PreviewIsDirty = true; // m_requireMaterialUpdate = true; // if( m_currentParameterType != PropertyType.Constant ) // BeginDelayedDirtyProperty(); // } // } // else // { // EditorGUI.BeginChangeCheck(); // m_defaultValue = EditorGUIObjectField( m_propertyDrawPos, m_defaultValue, typeof( DiffusionProfileSettings ), true ) as DiffusionProfileSettings; // if( EditorGUI.EndChangeCheck() ) // { // PreviewIsDirty = true; // BeginDelayedDirtyProperty(); // } // } // EditorGUIUtility.labelWidth = labelWidth; // style.fixedWidth = 0; // style.fixedHeight = 0; // style.stretchWidth = sw; // EditorStyles.objectField.fontSize = cache; // //} // //else if( drawInfo.CurrentEventType == EventType.Repaint ) // //{ // // bool guiEnabled = GUI.enabled; // // GUI.enabled = m_currentParameterType != PropertyType.Global; // // Rect fakeField = m_propertyDrawPos; // // if( GUI.enabled ) // // { // // Rect fakeLabel = m_propertyDrawPos; // // fakeLabel.xMax = fakeField.xMin; // // EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); // // EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); // // } // // bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; // // var value = currMode ? m_materialValue : m_defaultValue; // // //if( m_previousValue != value ) // // //{ // // // m_previousValue = value; // // // string stuff // // //} // // //GUI.Label( fakeField, m_fieldText, UIUtils.MainSkin.textField ); // // GUI.enabled = guiEnabled; // //} //} public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar) { base.GenerateShaderForOutput(outputId, ref dataCollector, ignoreLocalvar); if (m_currentParameterType != PropertyType.Constant) { return(PropertyData(dataCollector.PortCategory)); } return(RoundTrip.ToRoundTrip(HDShadowUtilsEx.Asfloat(DefaultHash))); }
public void NodeWithConverter() { var target = new WithConverterTargetClass { Property = "AbCd" }; var result = RoundTrip.Run(target); Assert.Equal("AbCd", result.Property); ReverseConverter.AssertReadWriteCalled(); }
public async Task WithConstructorEnumerableParameter() { var target = new ClassWithConstructorEnumerableParameter( new List <Guid> { new Guid("45b14050-065c-4be7-8bb8-f3b46b8d94e6"), new Guid("74b69ad1-f9e8-4549-8524-cce4a8b4c38b") }); var result = await RoundTrip.Run(target); Assert.Equal("74b69ad1-f9e8-4549-8524-cce4a8b4c38b", result.Property.Last().ToString()); }
public async Task RoundTripSucceeds(ChannelType type) { var o = new RoundTrip(); var co = await Init <IRoundTrip>(o, type); var testObj = co.GetObject(); var testObj2 = co.GetObject(); var verified = co.VerifyObject(testObj); Assert.IsNotNull(verified); Assert.AreSame(testObj, verified); Assert.AreSame(testObj, testObj2); }
public void FullCargoRoundTrip() { parameters = new Parameters(10000000.0f, 10000000.0f, null, TripType.RoundTrip); finder = new TradeFinder(map, market, parameters); finder.SortByProfitPerWarp(true); Assert.Greater(finder.RoundTrips.Count, 2); // There could be two trips reported in either order - from 41 to 31 and back, // or from 31 to 41 and back. We don't care about the order, so just pick one RoundTrip one = finder.RoundTrips[1]; RoundTrip two = finder.RoundTrips[2]; RoundTrip trip; trip = one; /* * if (one.There.ItemType == database.GetItemType("Navitas")) * trip = one; * else * trip = two; */ //Assert.AreSame(database.GetItemType("Navitas"), trip.There.ItemType); Assert.AreSame(map.GetStation(41), trip.There.Source); Assert.AreSame(map.GetStation(31), trip.There.Destination); //Assert.AreSame(database.GetItemType("Kernite"), trip.BackAgain.ItemType); Assert.AreSame(map.GetStation(31), trip.BackAgain.Source); Assert.AreSame(map.GetStation(41), trip.BackAgain.Destination); Assert.AreEqual(2, trip.There.Jumps(true)); Assert.AreEqual(5, trip.There.Warps(true)); Assert.AreEqual(2, trip.BackAgain.Jumps(true)); Assert.AreEqual(5, trip.BackAgain.Warps(true)); Assert.AreEqual(0.7f, trip.There.Security); Assert.AreEqual(0.7f, trip.BackAgain.Security); float quantityThere = 10; float quantityBackAgain = 7487.0f; float buyForThere = 112500.0f * quantityThere; float sellForThere = 118450.0f * quantityThere; float buyForBackAgain = 344.45f * quantityBackAgain; float sellForBackAgain = 352.9f * quantityBackAgain; Assert.AreEqual(buyForThere, trip.There.Cost); Assert.AreEqual(buyForBackAgain, trip.BackAgain.Cost); float profit = sellForThere + sellForBackAgain - buyForThere - buyForBackAgain; Assert.AreEqual(profit, trip.Profit); Assert.AreEqual(profit / 10.0f, trip.ProfitPerWarp(true)); }
public async Task ByteArrayList() { var target = new ClassWithByteArrayList { Property = new() { new byte[] { 2, 3 }, new byte[] { 5, 6 } } }; var result = await RoundTrip.Run(target); Assert.Equal(new byte[] { 5, 6 }, result.Property?[1]); }
public async Task Node() { var target = new TargetClass { SubProperty = new() { Property1 = "PropertyValue1", Property2 = "PropertyValue2" } }; var result = await RoundTrip.Run(target); Assert.Equal("PropertyValue1", result.SubProperty?.Property1); }
public async Task StringList() { var target = new ClassWithStringList { Property = new List <string> { "Value1", "Value2" } }; var result = await RoundTrip.Run(target); Assert.Equal("Value2", result.Property?[1]); }
public override string GetPropertyValue() { Vector4 asset = Vector4.zero; if (m_defaultValue != null) { asset = HDUtils.ConvertGUIDToVector4(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_defaultValue))); } string assetVec = RoundTrip.ToRoundTrip(asset.x) + ", " + RoundTrip.ToRoundTrip(asset.y) + ", " + RoundTrip.ToRoundTrip(asset.z) + ", " + RoundTrip.ToRoundTrip(asset.w); string lineOne = PropertyAttributes + "[ASEDiffusionProfile(" + m_propertyName + ")]" + m_propertyName + "_asset(\"" + m_propertyInspectorName + "\", Vector) = ( " + assetVec + " )"; string lineTwo = "\n[HideInInspector]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + RoundTrip.ToRoundTrip(HDShadowUtilsEx.Asfloat(DefaultHash)); return(lineOne + lineTwo); }
public void StringEnumerable() { var target = new ClassWithStringEnumerable { Property = new List <string> { "Value1", "Value2" } }; var result = RoundTrip.Run(target); Assert.Equal("Value2", result.Property.Last()); }
public void TestFixtureSetUp() { Parameters param = new Parameters(10.0f, 10.0f, "none", TripType.SingleTrip, 0); ItemDatabase database = TestObjectFactory.CreateItemDatabase(); Map map = TestObjectFactory.CreateMap(); SingleTrip there = new SingleTrip(map, map.GetStation(31), map.GetStation(11)); there.AddPurchase(new Transaction(new Trade(database.GetItemType("Navitas"), 1000.0f, 1), new Trade(database.GetItemType("Navitas"), 1100.0f, 1))); SingleTrip backAgain = new SingleTrip(map, map.GetStation(11), map.GetStation(31)); backAgain.AddPurchase(new Transaction(new Trade(database.GetItemType("Kernite"), 300.0f, 50), new Trade(database.GetItemType("Kernite"), 310.0f, 50))); trip = new RoundTrip(there, backAgain); SingleTrip backWithNothing = new SingleTrip(map, map.GetStation(31), map.GetStation(41)); badTrip = new RoundTrip(there, backWithNothing); }
public void GuidEnumerable() { var target = new ClassWithGuidEnumerable { Property = new List <Guid> { new Guid("45b14050-065c-4be7-8bb8-f3b46b8d94e6"), new Guid("74b69ad1-f9e8-4549-8524-cce4a8b4c38b") } }; var result = RoundTrip.Run(target); Assert.Equal("74b69ad1-f9e8-4549-8524-cce4a8b4c38b", result.Property.Last().ToString()); }
public void ByteArrayList() { var target = new ClassWithByteArrayList { Property = new List <byte[]> { new byte[] { 2, 3 }, new byte[] { 5, 6 } } }; var result = RoundTrip.Run(target); Assert.Equal(new byte[] { 5, 6 }, result.Property[1]); }
public void Node() { var target = new TargetClass { SubProperty = new SubClass { Property1 = "PropertyValue1", Property2 = "PropertyValue2" } }; var result = RoundTrip.Run(target); Assert.Equal("PropertyValue1", result.SubProperty.Property1); }
public void StringCollection() { var target = new ClassWithStringCollection { Property = new List <string> { "Value1", "Value2" } }; var result = RoundTrip.Run(target); Assert.AreEqual("Value2", result.Property.Last()); }
//public override void OnNodeLayout( DrawInfo drawInfo ) //{ // base.OnNodeLayout( drawInfo ); // m_propertyDrawPos = m_remainingBox; // m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE * 2; // m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; //} //public override void DrawGUIControls( DrawInfo drawInfo ) //{ // base.DrawGUIControls( drawInfo ); // if( drawInfo.CurrentEventType != EventType.MouseDown ) // return; // Rect hitBox = m_remainingBox; // bool insideBox = hitBox.Contains( drawInfo.MousePosition ); // if( insideBox ) // { // GUI.FocusControl( null ); // m_isEditingFields = true; // } // else if( m_isEditingFields && !insideBox ) // { // GUI.FocusControl( null ); // m_isEditingFields = false; // } //} //GUIStyle GetStyle( string styleName ) //{ // GUIStyle s = GUI.skin.FindStyle( styleName ) ?? EditorGUIUtility.GetBuiltinSkin( EditorSkin.Inspector ).FindStyle( styleName ); // if( s == null ) // { // Debug.LogError( "Missing built-in guistyle " + styleName ); // s = GUIStyle.none; // } // return s; //} //public override void Draw( DrawInfo drawInfo ) //{ // base.Draw( drawInfo ); // if( !m_isVisible ) // return; // var cache = EditorStyles.objectField.fontSize; // EditorStyles.objectField.fontSize = (int)(9 * drawInfo.InvertedZoom); // var style = GetStyle( "ObjectFieldButton" ); // var sw = style.stretchWidth; // style.stretchWidth = false; // //style.isHeightDependantOnWidth // style.fixedWidth = (int)( 16 * drawInfo.InvertedZoom ); // style.fixedHeight = (int)( 16 * drawInfo.InvertedZoom ); // //if( m_isEditingFields && m_currentParameterType != PropertyType.Global ) // //{ // float labelWidth = EditorGUIUtility.labelWidth; // EditorGUIUtility.labelWidth = 0; // if( m_materialMode && m_currentParameterType != PropertyType.Constant ) // { // EditorGUI.BeginChangeCheck(); // m_materialValue = EditorGUIObjectField( m_propertyDrawPos, m_materialValue, typeof( DiffusionProfileSettings ), true ) as DiffusionProfileSettings; // if( EditorGUI.EndChangeCheck() ) // { // PreviewIsDirty = true; // m_requireMaterialUpdate = true; // if( m_currentParameterType != PropertyType.Constant ) // BeginDelayedDirtyProperty(); // } // } // else // { // EditorGUI.BeginChangeCheck(); // m_defaultValue = EditorGUIObjectField( m_propertyDrawPos, m_defaultValue, typeof( DiffusionProfileSettings ), true ) as DiffusionProfileSettings; // if( EditorGUI.EndChangeCheck() ) // { // PreviewIsDirty = true; // BeginDelayedDirtyProperty(); // } // } // EditorGUIUtility.labelWidth = labelWidth; // style.fixedWidth = 0; // style.fixedHeight = 0; // style.stretchWidth = sw; // EditorStyles.objectField.fontSize = cache; // //} // //else if( drawInfo.CurrentEventType == EventType.Repaint ) // //{ // // bool guiEnabled = GUI.enabled; // // GUI.enabled = m_currentParameterType != PropertyType.Global; // // Rect fakeField = m_propertyDrawPos; // // if( GUI.enabled ) // // { // // Rect fakeLabel = m_propertyDrawPos; // // fakeLabel.xMax = fakeField.xMin; // // EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); // // EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); // // } // // bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; // // var value = currMode ? m_materialValue : m_defaultValue; // // //if( m_previousValue != value ) // // //{ // // // m_previousValue = value; // // // string stuff // // //} // // //GUI.Label( fakeField, m_fieldText, UIUtils.MainSkin.textField ); // // GUI.enabled = guiEnabled; // //} //} public override string GenerateShaderForOutput(int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar) { base.GenerateShaderForOutput(outputId, ref dataCollector, ignoreLocalvar); if (m_currentParameterType != PropertyType.Constant) { return(PropertyData(dataCollector.PortCategory)); } #if UNITY_2019_3_OR_NEWER return(RoundTrip.ToRoundTrip(HDShadowUtilsEx.Asfloat(DefaultHash))); #else return("asfloat(" + DefaultHash.ToString() + ")"); #endif }
public void ByteArrayDictionary() { var target = new ClassWithByteArrayDictionary { Property = new Dictionary <string, byte[]> { { "Key1", new byte[] { 2, 3 } }, { "Key2", new byte[] { 5, 6 } } } }; var result = RoundTrip.Run(target); CollectionAssert.AreEqual(new byte[] { 5, 6 }, result.Property["Key2"]); }
public void IntStringDictionary() { var target = new ClassWithIntStringDictionary { Property = new Dictionary <int, string> { { 1, "Value1" }, { 2, "Value2" } } }; var result = RoundTrip.Run(target); Assert.AreEqual("Value2", result.Property[2]); }
public void StringDictionary() { var target = new ClassWithStringDictionary { Property = new Dictionary <string, string> { { "Key1", "Value1" }, { "Key2", "Value2" } } }; var result = RoundTrip.Run(target); Assert.AreEqual("Value2", result.Property["Key2"]); }
public async Task IntStringDictionary() { var target = new ClassWithIntStringDictionary { Property = new Dictionary <int, string> { { 1, "Value1" }, { 2, "Value2" } } }; var result = await RoundTrip.Run(target); Assert.Equal("Value2", result.Property?[2]); }
public async Task IntGuidDictionary() { var target = new ClassWithIntGuidDictionary { Property = new Dictionary <int, Guid> { { 1, new Guid("45b14050-065c-4be7-8bb8-f3b46b8d94e6") }, { 2, new Guid("74b69ad1-f9e8-4549-8524-cce4a8b4c38b") } } }; var result = await RoundTrip.Run(target); Assert.Equal("74b69ad1-f9e8-4549-8524-cce4a8b4c38b", result.Property?[2].ToString()); }