小编may*_*c19的帖子

SCNBox每个面上都有不同的颜色或纹理

我是iOS开发的新手,我自己也很难过.我正在尝试使用每个面具有不同颜色的SceneKit渲染立方体.

这是我到目前为止所得到的:

func sceneSetup() {
    // 1
    let scene = SCNScene()

    // 2
    let BoxGeometry = SCNBox(width: 0.9, height: 0.9, length: 0.9, chamferRadius: 0.0)

    BoxGeometry.firstMaterial?.diffuse.contents = UIColor.redColor()
    let cube = SCNNode(geometry: BoxGeometry)
    cube.position = SCNVector3(x: 0, y: 0, z: -1)
    scene.rootNode.addChildNode(cube)

    // 3
    sceneView.scene = scene
    sceneView.autoenablesDefaultLighting = true
    sceneView.allowsCameraControl = true
Run Code Online (Sandbox Code Playgroud)

但我希望每张脸都有不同的颜色.我怎么做?

ios scenekit swift scnnode

22
推荐指数
2
解决办法
1万
查看次数

PowerMockito verifyNew withArguments 一个对象和一个对象数组

我正在尝试测试一个方法是否创建一个对象。我几乎可以使用 PowerMockito.verifyNew().withArguments() 来工作,但是,传递给构造函数的参数是一个对象和一个对象的 ArrayList。测试的输出是:实际

invocationSubstitute.performSubstitutionLogic(
1,
6,
11,
13,
[au.edu.sccs.csp3105.NBookingPlanner.Person@2449cff7],
au.edu.sccs.csp3105.NBookingPlanner.Room@62da83ed,
"description"
);
Run Code Online (Sandbox Code Playgroud)

预期的

invocationSubstitute.performSubstitutionLogic(
1,
6,
11,
13,
[au.edu.sccs.csp3105.NBookingPlanner.Person@40bffbca],
au.edu.sccs.csp3105.NBookingPlanner.Room@42a9a63e,
"description"
);
Run Code Online (Sandbox Code Playgroud)

我可以看到问题是对象是相同类型但不是同一对象,有没有办法说预期对象是正确的类型?

测试:

@RunWith(PowerMockRunner.class)
@PrepareForTest({Planner.class, Meeting.class})

public class MonthInput {

Planner planner;

@Rule
    public final TextFromStandardInputStream systemInMock = emptyStandardInputStream();
@Rule
    public final ExpectedSystemExit exit = ExpectedSystemExit.none();

@SuppressWarnings("deprecation")
@Before
public void setup() throws Exception {
    Meeting meetingMock = Mockito.mock(Meeting.class);
    PowerMockito.whenNew(Meeting.class).withAnyArguments().thenReturn(meetingMock);     
}

@Test
public void MonthInputofless5() throws Exception {
    // make spy
    planner = Mockito.spy(Planner.class);

    //override main menu with do …
Run Code Online (Sandbox Code Playgroud)

java junit junit4 powermockito

1
推荐指数
1
解决办法
4183
查看次数

C#if语句.如果不是a或b

我试图在列表中添加一个数字,但仅当数字不是255而不是0 id时才能避免嵌套if.我必须这样做的代码如下.

if (!(r == 255 || r == 0))
{
    rlist.Add(r);
    listBox2.Items.Add(Math.Floor(r).ToString());
}
Run Code Online (Sandbox Code Playgroud)

但是我仍然将255和0添加到列表框中,我无法弄清楚原因.谁能指出我做错了什么?在此先感谢您的帮助.

.net c# if-statement

-3
推荐指数
2
解决办法
255
查看次数

标签 统计

.net ×1

c# ×1

if-statement ×1

ios ×1

java ×1

junit ×1

junit4 ×1

powermockito ×1

scenekit ×1

scnnode ×1

swift ×1