express: Fix PointerToArray comparison operator

This commit is contained in:
rdb 2021-01-01 17:49:15 +01:00
parent b2462c1d8c
commit c81c506df3
2 changed files with 29 additions and 0 deletions

View File

@ -77,6 +77,12 @@ protected:
PUBLISHED:
INLINE ~PointerToArrayBase();
#ifdef CPPPARSER
// These are implemented in PointerToVoid, but expose them here.
INLINE bool operator == (const PointerToArrayBase<Element> &other) const;
INLINE bool operator != (const PointerToArrayBase<Element> &other) const;
#endif
};
#include "pointerToArrayBase.I"

View File

@ -1,3 +1,26 @@
def test_pta_float_compare():
from panda3d.core import PTA_float, CPTA_float
# Two null PTAs
assert PTA_float() == PTA_float()
assert not (PTA_float() != PTA_float())
# Two non-null PTAs
assert PTA_float([1]) != PTA_float([1])
assert not (PTA_float([1]) == PTA_float([1]))
# A copy of a PTA
pta = PTA_float([1])
assert pta == PTA_float(pta)
assert not (pta != PTA_float(pta))
# A const copy of a PTA
pta = PTA_float([1])
cpta = CPTA_float(pta)
assert pta == cpta
assert not (pta != cpta)
def test_pta_float_pickle():
from panda3d.core import PTA_float
from direct.stdpy.pickle import dumps, loads, HIGHEST_PROTOCOL