Skip to content

Double a PackedScene created via code #666

@gabahulk

Description

@gabahulk

Versions

What versions of Godot do you want to use this feature in?
4.3

The Feature

In my code I have a resource that has a PackedScene, and I want to test if some code gets that resource, instantiates the PackedScene, and calls some methods from the instance. I've tried to double an empty packed scene and stub return the double of the class in the PackedScene instantiate method like the code below, but that breaks the get_scene_script_object from GUT utils. I'm not sure if I'm doing it correctly, but if this isn't possible, it would be nice.

var instance= double(InstanceClass).new()
stub(instance, 'initialize').to_return("I'm stubbed!")
var doubled_scene = double(PackedScene).new()
stub(doubled_scene , 'instantiate').to_return(instance)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions