Skip to content

Commit 62ccad7

Browse files
Ayush1325ogoffart
authored andcommitted
Added Test for QStringList.
1 parent 3c5ad95 commit 62ccad7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

qttypes/src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,25 @@ impl fmt::Debug for QStringList {
17061706
}
17071707
}
17081708

1709+
#[test]
1710+
fn test_qstringlist() {
1711+
let mut qstringlist = QStringList::new();
1712+
qstringlist.push("One".into());
1713+
qstringlist.push("Two".into());
1714+
1715+
assert_eq!(qstringlist.len(), 2);
1716+
assert_eq!(qstringlist[0], QString::from("One"));
1717+
1718+
qstringlist.remove(0);
1719+
assert_eq!(qstringlist[0], QString::from("Two"));
1720+
1721+
qstringlist.insert(0, "Three".into());
1722+
assert_eq!(qstringlist[0], QString::from("Three"));
1723+
1724+
qstringlist.clear();
1725+
assert_eq!(qstringlist.len(), 0);
1726+
}
1727+
17091728
cpp_class!(
17101729
/// Wrapper around [`QJsonObject`][class] class.
17111730
///

0 commit comments

Comments
 (0)