/***************************************************************************************************
Copyright (C) 2023 The Qt Company Ltd.
SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
***************************************************************************************************/
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
namespace Qt.DotNet
{
public partial class Adapter
{
#if DEBUG || TESTS
///
/// Get current ref counters. For debug/test purposes.
///
/// Object ref. count
/// Static method ref. count
/// Event ref. count
public static void Stats(out int refCount, out int staticCount, out int eventCount)
{
refCount = ObjectRefs.Count;
staticCount = DelegateRefs.Count;
eventCount = Events.Count;
}
///
/// Built-in test
///
///
public static bool Test()
{
var ctorPtr = ResolveConstructor(1, new[] { new Parameter("FooLib.Foo, FooLib") });
var ctor = GetMethod(ctorPtr) as ConstructorInfo;
Debug.Assert(ctor != null, nameof(ctor) + " is null");
var objRef = GetRefPtrToObject(ctor.Invoke(Array.Empty