Skip to content

Commit

Permalink
make a test more permissive (#4197)
Browse files Browse the repository at this point in the history
* make a test more permissive

* only do that if freetype is installed
  • Loading branch information
greglandrum committed Jun 9, 2021
1 parent 054ac4b commit 9338bed
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions Code/GraphMol/MolDraw2D/test1.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2017 Greg Landrum
// Copyright (C) 2015-2021 Greg Landrum and other RDKit contributors
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
Expand Down Expand Up @@ -28,6 +28,16 @@
#include <fstream>
#include <sstream>

#ifdef RDKIT_USE_BOOST_REGEX
#include <boost/regex.hpp>
using boost::regex;
using boost::regex_search;
#else
#include <regex>
using std::regex;
using std::regex_search;
#endif

using namespace RDKit;

void test1() {
Expand Down Expand Up @@ -3540,11 +3550,12 @@ void testGithub3391() {
}

void testGithub4156() {
std::cout << " ----------------- Test Github 4156 - bad scale for radicals in grid"
<< std::endl;
std::cout
<< " ----------------- Test Github 4156 - bad scale for radicals in grid"
<< std::endl;
auto m1 = "C1[CH]C1[C@H](F)C1CCC1"_smiles;
auto m2 = "F[C@H]1CC[C@H](O)CC1"_smiles;

#ifdef RDK_BUILD_FREETYPE_SUPPORT
{
std::vector<ROMol *> mols;
mols.push_back(m1.get());
Expand All @@ -3557,8 +3568,8 @@ void testGithub4156() {
outs << text;
outs.flush();
// this is the start of the radical spot.
TEST_ASSERT(text.find("<path d='M 58.8277,79.4854 L 58.8245,79.4119") !=
std::string::npos);
regex qry("<path d='M 58.[0-9]*,79.[0-9]* L 58.[0-9]*,79.[0-9]*");
TEST_ASSERT(regex_search(text, qry));
}
{
std::vector<ROMol *> mols;
Expand All @@ -3572,10 +3583,10 @@ void testGithub4156() {
outs << text;
outs.flush();
// this is the start of the radical spot.
TEST_ASSERT(text.find("<path d='M 308.828,79.4854 L 308.825,79.4119") !=
std::string::npos);
regex qry("<path d='M 308.[0-9]*,79.[0-9]* L 308.[0-9]*,79.[0-9]*");
TEST_ASSERT(regex_search(text, qry));
}

#endif
std::cerr << " Done" << std::endl;
}

Expand Down

0 comments on commit 9338bed

Please sign in to comment.